I am often confronted with negative comments whenever I want to have a PHP script write output to a file on the server.
I use the fopen()
, fwrite()
and fclose()
functions.
The only way I know how to make this happen is to either set the permissions for the output file to 0666 or have it owned by "nobody" (which is the user that PHP runs under on our Apache web server).
So, if "0666" or "owned by nobody" are security risks, how do you successfully and securely allow a PHP script to write to a file?
Thanks for sharing guidance on this topic.