NYCPHP Meetup

NYPHP.org

File Write Permission Errors - HELP! URGENT!!!

Phil Powell soazine at erols.com
Mon Nov 25 07:29:14 EST 2002


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 . "\
"); 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20021125/a371a38d/attachment.html>


More information about the talk mailing list