If you want to create a file, the directory must be writeable to the server proces, so if the directory is
owned by you do
chmod o+w chat


Phil Powell wrote:

I did just that. Permissions are set the /chat folder as it is in all other
folders. This is the first time I've ever done fopen with "w" and I can't
get it to write, always getting "unable to access" errors. I want to be able
to create the file if it does not exist. It works for me to do "r" in all
other folders with the same permissions as /chat.

Phil

"Craig" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

you must give the same permissions to the folder also.


"Phil Powell" <[EMAIL PROTECTED]> wrote in message
0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6...
Hi I have the following code that breaks:

// PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT
$fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open "

.

$path . "/nicknames.txt");
chmod($path . "/nicknames.txt", 0755);
fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID);
$fileID = fopen($path . "/messages.txt", "a") or die("Could not open "

.

$path . "/messages.txt");
fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***");
fflush($fileID); fclose($fileID);


I am getting the following error:
Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission
denied in /users/ppowell/web/chat/chat.php on line 163

I am attempting to write onto the files if they exist, if not, create them
on the fly. I need the solution in the next 5 minutes - sorry, kind of an
emergency!

If anyone can help, please tell me what to do, the PHP manuals are not
giving me a clear solution as to how to write to a file that does not yet
exist that has to have the permissions of 0755 for both files.

Thanx
Phil








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to