Question: How to fix PHP Fatal error:  Class 'DOMDocument' not found in /var/www/html/index.php on line 171 or similar error?

NOTE: Received this error on a Centos 5 environment while trying to run a PHP script that makes use of the DOMDocument class

 

Answer

In the CLI (Command Line Interface) run the following command

{codecitation class="brush: shell;"}
yum install php-xml
{/codecitation}

This will install XML support and will solve the DOMDocument issue

VOTES:0
Thank you very much for this response. It helped me fix a problem I have been having for over a week.
VOTES:0
Worked a charm, thanks.. fir3net.com
VOTES:0
Rules, thanks!
VOTES:1
This is my second time stacking on this problem, fortunately, I found this place, thanks again.
VOTES:0
Ran into this issue when using the Wordpress importer. Seems to have worked. Only thing is that I had to restart Apache. I did it through the control panel, but the command line should be:

service httpd restart
VOTES:0
Thank you so much... It works..
VOTES:0
Thank you so much... It works..
VOTES:0
Thank you. It works for me too.
VOTES:-1