I have a php script that writes to a file. But when I try to actually write to the file I get permission denied. How can I tell what user name I need to add to the file permission in order for the php to write to it?
migrated from stackoverflow.com May 16 '10 at 23:57
|
|||||||||
|
|
whatever the file is, or directory for that matter, if apache needs to write to it, it needs to be owned by i would strongly recommend against changing the permissions to 777, simply because having world readable/writable files and directories on your server can pose some security risks. ultimately, i would configure your script to write to a set path, then change the ownership of that path to this poses it's own risks, too, as a compromised script can then write and potentially execute whatever it wants from that directory. as much of a pain as it may be, doing it file by file is less risky. |
|||
|
|
|
I tend to just CHMOD the file to 777, assuming you're running on a Unix platform. May not be the most secure thing ever, must gets the job done reliably. I'm sure others will have a better solution though! |
|||||||
|