Class 'SimpleXMLElement' not found on puphpet PHP 5.6

主宰稳场 提交于 2019-11-30 06:55:52

问题


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


回答1:


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




回答2:


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



回答3:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!