Hello,
I have a script that changes data in xml during its run. In case the user abort somehow (back/stop) I want to write to the XML that it was aborted.
So in the shutdown function I try to open the xml file as usual, but I get this error:
simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: I/O warning : failed to load external entity "uploads/file.xml"
Are there any restrictions in the shutdown function that I should be aware of??
BTW I'm using php 5.2.9
Noam
simplexml_load_file fails inside shutdown function
Moderator: General Moderators
Re: simplexml_load_file fails inside shutdown function
Just found the answer in PHP doc:
If you want to do something with files in function, that registered in register_shutdown_function(), use ABSOLUTE paths to files instead of relative. Because when script processing is complete current working directory chages to ServerRoot (see httpd.conf)
If you want to do something with files in function, that registered in register_shutdown_function(), use ABSOLUTE paths to files instead of relative. Because when script processing is complete current working directory chages to ServerRoot (see httpd.conf)