Search code examples
phpapachepuphpet

Class 'SimpleXMLElement' not found on puphpet PHP 5.6


I've been stuck at this error for hours now and I can't seem to find anything useful on the internet about it. The error is the classic

Fatal error: Class 'SimpleXMLElement' not found in 
/var/www/NavPHP/nav/plugin/log/NavLog.php on line 29

I'm not using Namespace so that's not the problem.

It's a project that works fine in production and used to work in my former computer with WampServer and PHP 5.6.2. Now that I got a new computer, I'm interested in setting up a virtual environment with puphpet, but I'm getting this error.

According to Docs, the SimpleXMLElement class should come with PHP by default. I didn't find any important information on php.ini and in my phpinfo() there's the following:

SimpleXML   Sterling Hughes, Marcus Boerger, Rob Richards

Any tips?

Thanks

Update

Just to add this

enter image description here


Solution

  • The problem was that I was using Cent OS and in this Linux Distribution, the php-libxml package does not come as default.

    I ended up generating a new machine through PuPHPet GUI and added to the System Package the following packages to be installed:

    php-xml, php-simplexml
    

    Problem solved.


    For those using PHP 7 and Ubuntu, @MPS solved it by running apt-get install php7.0-xml and service apache2 restart.

    On Centos, we need to install the XML php package. You can try yum install php56w-xml or yum install php70w-xml if you're using php70w repository for PHP 7.0