(solved) PHP does not always find XML file

ntom

New Member
Solved: error in code, not serverI looked around for similar questions but found none identical, so here goes:I have this webpage on a linux/apache server, the PHP script opens a XML-file upon every execution, the funny thing is that sometimes it can read the file and on some rare occasions it can not.. And when it cannot read it says that the file does not exist and to fix it I just have to refresh the page.The XML file can be found in a sub directory (e.g. \[code\]/srv/www/page/subdir/file.xml\[/code\]) and can only be changed manually and have the right privileges set (PHP can read and write to it).I am using simplexml and the error I get is: \[code\]I/O warning : failed to load external entity\[/code\]So something strange is going on in the server, I just can't figure out what..EDIT, adding some code\[code\]if ( !file_exists( $file ) ){ error_log("File " . $file . " does not exist!"); //return FALSE;}if ( $obj = simplexml_load_file( $file ) ){ // do stuff return TRUE;}else{ error_log("Could not parse XML: " . $file ); return FALSE;}\[/code\]
 
Back
Top