Apache and linux file permissions
Solution 1:
For ubuntu the apache and PHP user is www-data.
Run sudo chown www-data:www-data web/uploads/ -R
and see if that fixes your issue.
Also don't use 777 for the file permissions as Ignacio Vazquez-Abrams stated "0444 or 0664 for files, and 0555 or 0775 for directories"
Solution 2:
Foremost, files that are to be accessed by the web server in either read or write should usually be owned by the user and group the web server is running as (apache:apache
or nobody:nobody
, not sure about the exact values on Ubuntu).
From there, the user should have r
on files and rx
on directories, except where write permissions are required. The group should usually match the user permissions. Everyone else should have read-only. This translates into 0444
or 0664
for files, and 0555
or 0775
for directories.
Of course, you may have reasons for breaking this scheme in specific locations, but these are the base values you should have.