Permission denied

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phwhat?
Forum Newbie
Posts: 2
Joined: Thu Oct 26, 2006 6:50 pm
Location: Finchley

Permission denied

Post by phwhat? »

I was making very basic amends to an rtf file and, though I never touched, looked at or went anywhere near lines 272, 273 or 274, I now get this error message :

Warning: fopen(../companies/mediapack.rtf) [function.fopen]: failed to open stream: Permission denied in /home/cosmetic/public_html/admin/sendmediapack.php on line 272

Warning: fwrite(): supplied argument is not a valid stream resource in /home/cosmetic/public_html/admin/sendmediapack.php on line 273

Warning: fclose(): supplied argument is not a valid stream resource in /home/cosmetic/public_html/admin/sendmediapack.php on line 274

Is it because I is Mac?!

Could anyone advise? :?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Those are the lines in your php file where your script is failing (and why).
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

If you haven't already I suggest you use an FTP client to CHMOD this file, you recieved permissions denied, that sounds like your file might notbe set to 755
phwhat?
Forum Newbie
Posts: 2
Joined: Thu Oct 26, 2006 6:50 pm
Location: Finchley

Permission denied

Post by phwhat? »

Thanks for your replies.
Sorry, yes, lines 272 to 274 in the php file are thus:

$fp= fopen("../companies/mediapack.rtf", "wb");
fwrite($fp, $data); # write to file
fclose($fp);

I don't know whether this is a php error, rtf error or that I've breached some security device in the system. I didn't change the php coding which would suggest one of the other two.

Errr... What's 755?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That error means that PHP cannot open the file for reading/writing. 0755 is a Unix/Linux file/directory permission setting. Before messing the permissions you should read up on *nix file permissions and how they can affect the security of your server.
Post Reply