(SOLVED, see below) "Dan Baker" <dbefc@xxxxxxxxxxxxxxxx> wrote in message news:du4i38$ppt$1@xxxxxxxxxxxxxxxx > "Chris" <dmagick@xxxxxxxxx> wrote in message > news:4404E180.9020901@xxxxxxxxxxxx >> Dan Baker wrote: >>> I have the following code snippet: >>> $h = fopen("$path/file.txt", 'x+'); >>> >>> And it generates the following error: >>> Warning: fopen(/home/...../myarea/file.txt): failed to open stream: >>> Permission denied >>> >>> The path is correct, but the php process doesn't seem to have file >>> permissions in the folder. >>> Is there some magic I can do to allow php to have file rights to the >>> "myarea" folder? (This is on a purchased ISP site) >> >> Go in through ftp or ssh and fix the permissions. >> >> If you only want to read the file, then it only needs to be 644. >> >> If you need to write the file it will either need to be 646 or 664. >> >> That's your only option apart from deleting the file (through ftp) and >> recreating it through your php script ... or getting your host to change >> to the CGI version of php which is most unlikely to happen. > > I'm actually trying to create the file (thus the 'x+' mode). The file > doesn't exists. It appears to me that the php process doesn't have > permission to the entire folder. My ftp client has full access to the > folder ("myarea"), but the php process doesn't. The folder is under the > http folder. I'll check if I can alter the permissions on the "myarea" > folder. I took the suggestion from Chris, and checked the permissions on the "myarea" folder. They were set so others could NOT "write". I added this permission, and everything works great now! Thanks for the pointer Chris DanB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php