Page 1 of 1

write to file? acces denied?

Posted: Mon Jun 03, 2002 12:54 pm
by opcd
hey,

I got myself into trouble...
i wrote a guestbookscript which writes and reads from a textfile but it cant write to the text file; reading it doesn't seem to be a problem
when i try to write it gives following error:

"Warning: fopen("test.txt","w") - Permission denied "

i tried several things like filling in r+, a+, even "b" instead of "w" but it doesn't seem to work no matter what i try...

Code: Select all

<?php
$fileopenen = fopen($filepath, "a"); 
fwrite($fileopenen,$toevoegsel);
fclose($fileopenen);

?>
does this have to do with the server?
hope you guys can help me out...
greets opcd

Posted: Mon Jun 03, 2002 1:27 pm
by volka
most filesystems have permission settings for files. On unix-style systems that are (mainly) read, write and execute; permissions are set by the command chmod.
you may change the permissions either by php-script or ftp-client.
common settings are
chmod 755 <file>
or chmod 754 <file>
(depending on security matters - but a guestbook file.......)

take a look here:
a short tutorial on unix file permissions (there are plenty of those - this was the first returned by google ;) )
php chmod()