samedi 4 mars 2017

simplexml_load_file() error is showed some every X hours

I have an Ubuntu 16.04 server, there I installed PHP7+Nginx+MySQL. Also I have a web application developed in Laravel 5.1 in which I take some uploaded files (by the user, they content XML) and read them, I use xml_load_file() to do this, in my local environment everything work great! Then, in the server when I just cloned the project there I noticed than that function was not working, instead it returned this error:

simplexml_load_file(): I/O warning : failed to load external entity "/tmp/phpSFeOBP"

So, I researched and noticed that I had to enable allow_url_fopen in the php.ini file, so I did it and restarted the server using:

sudo systemctl restart php7.0-fpm

And then it started to work great, but, something strange it happening now, every some hours the server gives the error, and I have to be restarting the php7.0-fpm over and over again, and the php.ini file is the same, it's not modified, so I don't really know what is,what should I do or even why is happening.

To be more especific, this is the code that I have in my project to read the file (and the file exist,so it's not the problem):

ini_set('allow_url_fopen', 'on');//I set this to ensure,but nothin happens
$xml = simplexml_load_file($file);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire