Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagejpeg - Unable to open file for writing: Permission denied

I am getting this error / warning:

Warning: imagejpeg(): Unable to open '/var/www/my_web/data/my_web/www/users/avatars/user125.jpg' for writing: Permission denied in /var/www/my_web/data/classes/class.Image.php on line 157

On line 157, there is

  imageJPEG($image, $this->destPath, $this->jpgQuality);

My avatars folder has permission set to 777, $this->destPath is '/var/www/my_web/data/my_web/www/users/avatars/user125.jpg'

How could I solve this problem?

like image 904
Martin Perry Avatar asked Dec 25 '14 15:12

Martin Perry


2 Answers

Set destination path to 777 permission with user www-data

be careful with the user-group : www-data

chmod -R 777 /var/www/my_web/data/my_web/www/users/avatars/
like image 67
EngineerCoder Avatar answered Oct 21 '22 06:10

EngineerCoder


You should set 777 permission for jpeg file too. Check permission of jpg.

like image 5
Ali insan Soyaslan Avatar answered Oct 21 '22 08:10

Ali insan Soyaslan