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
Create an empty PHP file and put only <?php phpinfo();
in it, look at it in a browser.
Check if you can spot --disable-dom
in the configuration options and/or if you can see details about the DOM extension in the list below.
If you cannot see DOM in the list or you see it is disabled, your PHP installation does not include the DOM extension. You'll need to recompile your PHP installation from source to remedy that.
For PHP 7.4 Install the DOM extension.
Debian / Ubuntu:
sudo apt-get update
sudo apt-get install php7.4-xml
sudo service apache2 restart
Centos / Fedora / Red Hat:
yum update
yum install php74w-xml
systemctl restart httpd
For previous PHP releases, replace with your version.
PHP 7.X Centos 7
I got dependency issues when trying to install module with above suggestions, adding this flag:
--enablerepo=remi-php7X
Resolved dependencies.
So
sudo yum --enablerepo=remi-php7X install php-xml
Then
service httpd restart
Ref: Install PHP Modules
PHP7: the latest version:
sudo apt-get install php7.1-xml
you can also do:
sudo apt-get install php-dom
and apt-get will show you where it is
I'm using Centos and the followings worked for me , I run this command
yum --enablerepo remi install php-xml
And restarted the Apache with this command
sudo service httpd restart
On fedora 26:
dnf install php-dom
Fixes it !