I would like to save some info to a file on my server using the __destruct()
function in one of my classes.
However, every time I try to use file_put_contents(...)
inside __destruct()
, I get this error:
Warning: file_put_contents(HTMLcache.txt): failed to open stream: Permission denied in /Applications/MAMP/htdocs/time/HJ_Tag.php on line 141
file_put_contents(...)
works just fine in other parts on my code, where it is called on the exact same file. What might it be causing this error during __destruct()
, and how can I fix it?