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
Using Suse Linux (Linux linux 3.16.7-48-default) and PHP 5.6.1 as root, this helped:
zypper in php5-dom
plus restart
systemctl restart apache2
Package php-dom is a virtual package provided by:
php7.1-xml 7.1.3+-3+deb.sury.org~xenial+1
php7.0-xml 7.0.17-3+deb.sury.org~xenial+1
php5.6-xml 5.6.30-9+deb.sury.org~xenial+1
You should explicitly select one to install.
In case anyone using 5.6 versions then go with this way
sudo apt-get install php5.6-xml
For Php Ver PHP7, Ubuntu:
sudo apt-get install php7.1-xml
or by
yum install php-xml
For Centos 7 and php 7.1:
yum install php71w-xml
apachectl restart
I'm using CentOS 7 with virtualmin and three PHP versions. I also have REMI repo enabled. it worked for me:
Just append PHP major version number like this php{version number}-xml
. And run yum install
yum install php70-php-xml
yum install php71-php-xml
yum install php72-php-xml
Don't forget to restart Apache:
service httpd restart
You need to install the DOM extension. You can do so on Debian / Ubuntu using:
sudo apt-get install php-dom
And on Centos / Fedora / Red Hat:
yum install php-xml
If you get conflicts between PHP packages, you could try to see if the specific PHP version package exists instead: e.g. php53-xml
if your system runs PHP5.3.
If you are using PHP7.0 to install Magento, I suggest to install all extensions by this command
sudo apt-get install php7.0 php7.0-xml php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql php7.0-gd libapache2-mod-php7.0 php7.0-intl php7.0-soap php7.0-zip php7.0-bcmath
I need to Google some times to meet Magento requirement.
I think you can replace the PHP version to 7.x if you use another PHP version
And restart Apache is needed to load new extensions
sudo service apache2 restart