Imagejpeg - Unable to open file for writing: Permission denied

I get this error / warning:

Warning: imagejpeg (): Cannot open '/var/www/my_web/data/my_web/www/users/avatars/user125.jpg' for email: permission denied in / var / www / my _web / data / classes / class .Image.php on line 157

Line 157 has

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

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

How can I solve this problem?

+4
source share
2 answers

Set destination path for 777 using user www-data

be careful with the user group: www-data

chmod -R 777 /var/www/my_web/data/my_web/www/users/avatars/
+5
source

You must also set the resolution to 777 for the jpeg file. Check jpg resolution.

+3

Source: https://habr.com/ru/post/1568967/


All Articles