Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission denied

Status
Not open for further replies.

fsqueeen

Programmer
Jul 8, 2002
43
0
0
MY
help.... Below are the codes to create "names.txt" in my server. but why there's still error when i execute it in server? (it runs well in localhost)

php file
----------
$fp = fopen( "names.txt", "w" );

chmod("names.txt", 0777);

if(!$fp)
{
echo "Couldn't open the data file. Try again later.";
exit;
}

$fp = fopen( "names.txt" , "w" );
fwrite( $fp, $message );

fclose( $fp );


error
------
Warning: fopen(names.txt): failed to open stream: Permission denied in /home/sonyaibo/public_html/sendmail.php on line 9
Couldn't open the data file. Try again later.
 
Seems you don't have permission to fopen the file. setting chmod after fopen won't help offcourse, if that is allowed you should do it before the fopen.

Why do you fopen that file twice anyway?
 
wat a silly mistake i had made! thanks herman75!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top