I\'ve found an error on a page in my Magento application; it always show this message error when I visit it:
Fatal error: Class \'DOMDocument\' not fo
PHP 7.0:
apt-get install php7.0-xml
yum install php70w-xml
PHP 7.1:
apt-get install php7.1-xml
yum install php71w-xml
PHP 7.2:
apt-get install php7.2-xml
yum install php72w-xml
PHP 7.3:
apt-get install php7.3-xml
yum install php73w-xml
PHP 7.4:
apt-get install php7.4-xml
yum install php74w-xml
After a long time suffering from it in PHPunit...
For those using namespace, which is very common with Frameworks or CMS, a good check in addition to seeing if php-xml is installed and active, is to remember to declare the DOMDocument after the namespace:
namespace YourNameSpace\YourNameSpace;
use DOMDocument; //<--- here, check this!
This help for me (Ubuntu Linux) PHP 5.6.3
sudo apt-get install php5.6-dom
Thats work for me.
If compiling from source with --disable-all
then DOMDocument support can be enabled with
--enable-dom
Example:
./configure --disable-all --enable-dom
Tested and working for Centos7 and PHP7