File Write Permission Errors - HELP! URGENT!!!
| From: | Phil Powell | Date: | Mon, 25 Nov 2002 12:29:14 +0000 |
| Subject: | File Write Permission Errors - HELP! URGENT!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125921@lists.php.net to get a copy of this message | ||
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