Search code examples
phplinuxdomdocumentcentos7codeception

ERROR: Class 'DOMDocument' not found



I am using Centos 7, PHP7.0.14

I ran codeception for the very first time then I got an error message saying

Test tests/acceptance/WelcomeCept.php
[Error] Class 'DOMDocument' not found

Saw many posts recommending php-xml, which sadly didn't quite worked for me.

Below is the Error I get!
Error: Package: php-xml-5.4.16-42.el7.x86_64 (base)
  Requires: php-common(x86-64) = 5.4.16-42.el7
  Installed: php-common-7.0.14-1.el7.remi.x86_64 (@remi-php70)
     php-common(x86-64) = 7.0.14-1.el7.remi
  Available: php-common-5.4.16-42.el7.x86_64 (base)
     php-common(x86-64) = 5.4.16-42.el7

Can someone please help out on this?
It will be great if it includes the reason with the solution!
Thank you! :)


Solution

  • You need the dom extension, as you have installed PHP 7.0 from remi-php70 repository, you need to pull this extension from the same repository.

    yum --enablerepo=remi-php70 install php-dom
    

    Probably simpler to enable this repository permanently to avoid such issue in the future, and take benefit of upcoming versions

    yum-config-manager --enable remi-php70
    yum install php-dom
    

    As explained by the Wizard.