Skip to Content

Class ’DOMDocument’ not found

How to solve Error: Class 'DOMDocument' not found?


Overview: This article describes resolving the error "Class 'DOMDocument' not found" by installing either php-dom or php-xml, essential PHP extensions enabling XML manipulation for SAML functionality in the specified file path.


Getting an error on clicking the SAML tab 

Class 'DOMDocument' not found /var/www/ezlogin/application/third_party/saml/lib/IdPMetadataParser.php

To resolve the error message "Class 'DOMDocument' not found" in PHP when working with SAML and encountering issues with IdPMetadataParser.php, you need to install the necessary PHP extension php-dom or php-xml. These extensions provide support for XML manipulation, which includes the DOMDocument class required by your SAML library.

Step 1: Installing php-dom or php-xml will solve the problem.

  • For Ubuntu/Debian:

root@gateway:~# apt-get install php-dom/php-xml

  • For CentOS/RHEL:

root@gateway:~# yum install php-xml

Step 2: Restart the web server after installing 

root@gateway:~# systemctl restart apache2


Related Articles:

Error log files and configuration files to troubleshoot.