PDA

View Full Version : PHP fopen() Permission Denied Error


ccarlson
04-04-2003, 02:28 PM
Hey guys,

Got a question for ya. When I am running one of my personal PHP scripts, I am getting this warning message:

Warning: fopen(/home/redcarbo/public_html/data/chrisTT.txt) [function.fopen]: failed to create stream: Permission denied in /home/redcarbo/public_html/troubletckts.php on line 63.

Here's line 63:

$dataFile = fopen($pathToData.$_GET['username']."TT.txt","w+");

I wasn't getting this error on a previous server that I was running the script on, but I think it may have something to do with new security considerations in recent versions of PHP.

Any ideas?

Thanks,

Chris Carlson

pete3005
04-04-2003, 09:58 PM
Did you CHMOD the file to allow writing?

Test by using:

$myfile = $pathToData.$_GET['username']."TT.txt";

if (!is_writeable($myfile)){
echo 'The file is not writable';
}

You will need to CHMOD to 666.

HTH

Pete

ccarlson
04-04-2003, 10:19 PM
*feels really stupid*

Ok, maybe web design isn't for me. lol

Thanks for the quick reply. I can now move on with life.

pete3005
04-05-2003, 12:34 AM
It's an easy mistake to make because when something doesn't work we all usually assume its something complex.
Always look for the obvious first, at least now when you encounter the same problem you will know what it is :)

Pete