simplexml_load_file PHP does not work at all

Asked

Viewed 967 times

0

(I am using Ubuntu)

I tried everything I imagined was the problem. I tried first using the site I want to collect the XML that is from any Youtube channel.

Failed...

Then I tried downloading it and then putting it in the server folder to see if it changed anything.

Failed...

I looked if my php.ini was with allow_url_fopen = On, and yes, I was On.

It is always the same error. It delivers in the browser console the Failed to load Resource: the server responded with a status of 500 (Internal Server Error), does not matter, whether the file exists, or not.

Can someone tell me what’s going on?

  • If error 500 originates on your server see the logs.

  • You know where you find these logs on Ubuntu?

  • Give a php -i | grep 'log', it should list the log paths. Also look in Apache/Nginx (in the case of Apache it is usually /var/log/apache2/error.log). But, it depends if this error is being generated by your server or the server you want to connect to, so the question seems to be that who generates such an error is Youtube.

  • 1

    This doesn’t just happen when I try to connect to the Youtube file, it happens to any file from anywhere, even inside the server. I have also tried Deviantart, news sites, always the same thing. And the error is only present in this command. I managed to get to the log, and the error was this: Uncaught Error: Call to Undefined Function simplexml_load_file() in /var/www/html/test/index3.php:41 nStack trace: n#0 {main} n thrown in /var/www/html/test/index3.php on line 41, referer: http://[IP_HIDE]/test/index3.php

  • You do not have XML installed, give a apt install php7.0-mbstring php7.0-zip php7.0-xml, for example, see this http://stackoverflow.com/questions/35593521/php-7-simplexml.

  • It worked. I really appreciate your help. If you can, put this as an answer so I can wrap up the topic with all the credits to you :)

Show 1 more comment

1 answer

2


He had also tried everything, only worked localhost, on the server gave the same error. I tried this tip that was small in the comment above and it worked:

apt install php7.0-mbstring php7.0-zip php7.0-xml

Thank you!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.