Mark
Mark

Reputation: 309

imagejpeg() permission problems

Im trying to create thumbnails using gd library and am using the imagejpeg() function. The output then shows the following error

Warning: imagejpeg() [function.imagejpeg]: Unable to open '/var/www/html/yahoo/thumbs/1136.jpg' for writing: Permission denied in /var/www/html/yahoo/Thumbnail.php on line 56

I have set full 777 permissions on the thumbs folder, is there something else that could be causing this, or am i missing something here.

thanks :)

Ive tried creating the file with fopen and am getting the same issue.. fopen returns the following warning:

Warning: fopen(/var/www/html/yahoo/thumbs/1176.jpg) [function.fopen]: failed to open stream: Permission denied in /var/www/html/yahoo/Thumbnail.php on line 56 can't open file

Upvotes: 1

Views: 5205

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798626

SELinux is preventing HTTPd from writing into that directory. Use chcon to change the file context of /var/www/html/yahoo/thumbs/ to httpd_sys_rw_content_t, and if that lets it work then use semanage to make it permanent.

Upvotes: 3

Related Questions