Page 1 of 1

PHP file permissions

Posted: Tue Oct 21, 2008 5:58 pm
by JonGhost
Hey all,
I made a script that creates a file, if it doesn't exist, through fwrite()

The only problem is that when I try writing to this file again later on, it will deny me access. So I have been trying chmod and FTP+chmod to change the permissions on the file to 0666 so I don't run into the access denied error. I can connect and ftp in using the script, but it won't let me chmod the file.

So my problem is that I want to write to a file over and over again in different sessions in different UIDs (kind of like a wiki), but fwrite() keeps returning errors saying that the file is not writable. Is there some fix for this?

Re: PHP file permissions

Posted: Tue Oct 21, 2008 7:13 pm
by requinix
Just to cover all my bases, you A (when you FTP into your server) and you B (your PHP scripts) are different people. If A creates a file B can't do anything do it. And vice versa.
"Do anything" includes writing and chmod'ing.

Now, fwrite() doesn't normally say "not writable", it says something more specific like "permission denied". Code says that it's not writable.
Speaking of, what's your code?