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
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
I faced this issued and finally solved by run following command :
apt install php5.6-xml
After it reload and restart apache2 service :
service apache2 reload
service apache2 restart
If you are running ubuntu in AWS Cloud 9. Then from your menu bar->Window->New Terminal->type sudo apt install php-xml
来源:https://stackoverflow.com/questions/35223926/class-simplexmlelement-not-found-on-puphpet-php-5-6