Mosty Amine Mosty Amine - 1 year ago 101
Linux Question

PHP DomDocument class doesn't exist

I was trying to use the class

in my php code on redhat linux server, but when I have tried the following code:

echo "class_exists(\"DomDocument\") = ".(class_exists("DomDocument")?" EXISTS ":" NOT EXISTS ")."<br>";

it prints:

class_exists("DomDocument") = NOT EXISTS

after a small search I found that the extension
should be installed, but the class still not exist, and the following is a snippet from
php -i


DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.6.26
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled

What is still missing to make this
class work?

Answer Source

Could you check your php.ini and see if it contains the line?

Also both libxml and DOM has to be enabled but they are by default so that shouldn't be a problem if you haven't messed with the ini before and your php -i confirms that.