PHP imagejpeg() Warning, unix folder permissions

Zoo

Zoo

Associate
Joined
8 Sep 2006
Posts
15
I've written a script on my localhost (windows machine) which takes an uploaded jpg file, resizes it if it is too large and then places the resized image in a directory. This all works fine.

When I upload the script to my webhosting, which is a unix machine, I'm getting the error message: "Warning imagejpeg(): Unable to open..." and the script fails. I've done a bit of googling and found that the problem can be caused by permissions. I've looked on my FTP and all my folders have permission 755 (no write for users or group). When I try and change these to 777 as a lot of sites suggest, I get a "Permission denied". I've also tried using PHP's chmod function but the execution was denyed, presumably by the server. I read somewhere that scripts will execute under a different user, so even though my FTP username has write permission to the folders, when my script executes, they won't. Is this the case? And presumably if this is the case, it's the cause of the failing imagejpeg() function?

If this is the case, and I can't change the folder permissions though my FTP either, do I need to speak to the system administrator and ask him to allow me to change folder permissions?

Thanks.
 
Back
Top Bottom