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 found in /home/.../lib/Zend/Feed/Abstract.php on line 95

Can you give me a solution? I'm using magento 1.4.1.1.

share|improve this question
1  
This answer (enable php-xml) seems coherent, why doubt it instead of just testing it? From a few google searches it seems to be one of the possible issues – koopajah Jan 18 '13 at 8:52
1  
i just scare when i try "yum install php-xml", it will disturb my magento site.. – ws_123 Jan 18 '13 at 8:58

11 Answers 11

up vote 139 down vote accepted

You need to install the DOM extension. You can do so on Debian / Ubuntu using:

sudo apt-get install php5-dom

And on Centos / Fedora / Red Hat:

yum install php-xml

If you get conflicts between PHP 5 and PHP 5.3 packages, you could try to see if the php53-xml package exists instead.

share|improve this answer
    
what about centos.. – ws_123 Jan 18 '13 at 9:06
    
For Cent OS: smartwebdeveloper.com/centos/… – JNDPNT Jan 18 '13 at 9:42
2  
i tried it, there is message in putty.. ... Error: php53-common conflicts with php-common ... – ws_123 Jan 18 '13 at 9:52
14  
installing php-xml solved this for me but don't forget the 'service httpd restart' – zzapper Oct 29 '13 at 15:36
2  
For me: sudo apt-get install php7.1-xml – Rafael Barros Aug 1 '17 at 19:33

PHP7, Ubuntu:

apt-get install php7.0-xml

PHP7, CentOS / Fedora / Red Hat:

yum install php70w-xml

PHP7.1, Ubuntu:

apt-get install php7.1-xml

PHP7.1, CentOS / Fedora / Red Hat:

yum install php71w-xml
share|improve this answer
    
Great! Where did you find this? – Tieme Mar 4 '16 at 18:56
    
@Tieme somewhere on the Internet :) – Limon Monte Mar 4 '16 at 23:16
1  
Thanks a lot for 7.0 solution! – Mat Mar 8 '16 at 21:17
    
thank you for php7 – slier Mar 29 '16 at 10:08
3  
remember to restart apache afterwards – Jahmic Oct 29 '16 at 6:16

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

share|improve this answer

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
share|improve this answer
2  
Thanks, restarting the server worked! I had to do service apache2 restart on ubuntu. – user3413723 Feb 11 '17 at 15:50
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
share|improve this answer

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.

share|improve this answer
    
i found --disable-dom in Configure Command, what should i do next? – ws_123 Jan 18 '13 at 9:38
    
That depends on your system. Worst case you have to recompile PHP from scratch. – deceze Jan 18 '13 at 9:46
    
Relying on configure option is most often a mistake, read blog.remirepo.net/post/2010/09/29/phpinfo-BUG-or-PEBKAC so it have been removed from phpinfo output in some distrobution (debian, fedora...) – Remi Collet Feb 20 '16 at 9:48
    
If compiled from source, you could use --enable-dom – DidThis Nov 7 '17 at 11:51

This help for me (Ubuntu Linux) PHP 5.6.3

sudo apt-get install php5.6-dom

Thats work for me.

share|improve this answer

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
share|improve this answer

On fedora 26:

dnf install php-dom

Fixes it !

share|improve this answer

For Centos 7 and php 7.1:
yum install php71w-xml
apachectl restart

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.