简体   繁体   中英

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?

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM