I'm using a Log class to store messages during execution, and then it is supposed to write these messages to a file on shutdown (with register_shutdown_function).
But for some reason, I'm always getting "file_put_contents failed to open stream: No such file or directory". It shouldn't be a problem that the file doesn't exist, file_put_contents should create the file. In fact, everything works just fine if I do the write during execution (ie: before the shutdown function is called).
Is this a php bug?
Make sure you use an absolute path. Relative paths aren't guaranteed to work in the shutdown function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With