Forum Moderators: coopster

Message Too Old, No Replies

can't write to file?

         

scorpion

9:12 pm on Jan 29, 2003 (gmt 0)

10+ Year Member



I get this msg for a script I wrote:

Warning: fopen("../index.html", "w+") - Permission denied in /home/htdocs/script/admin/admin.php on line 322
unable to create file (../index.html)

the whole directory structure from /script downward was chmodded to 777, there is already a file index.html in that directory, I suppose it should be overwritten. Strangely when i ftpped in, the 777 permission was removed from the dir...

any ideas?

jatar_k

9:15 pm on Jan 29, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



did you try changing it back to 777? What happened?

scorpion

9:42 pm on Jan 29, 2003 (gmt 0)

10+ Year Member



sorry, it works if EVERY file is individually chmodded to 777 (i use ws_ftp lite), but not if you just chmod the directory.

toadhall

9:43 pm on Jan 29, 2003 (gmt 0)

10+ Year Member



Did you test for the changed mode? Maybe it didn't happen. I left off the "0" in front of the mode triplet once and more than a few hours of confusion passed before I saw it.

chmod ("dirname", 0777);

T

jatar_k

9:44 pm on Jan 29, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if it is writing over a file it has to be allowed to do so. There is a chmod [php.net] function that might help you out.

<added>toadhall is quick.