Reputation: 101
From my comprehensive search on Stack Overflow, the question is very popular, but none of the solutions apply to my case.
The problem is with the permissions for both folders app/cache and app/logs in fresh Symfony2 installation.
I've tried the tutorial from http://symfony.com/doc/current/book/installation.html#configuration-and-setup and it didn't work for me.
I'm running Apache 2.4.18, on Ubuntu 14.04.
When I check the config.php file through a browser, it says that I need to change the permissions for the folders app/cache and app/logs
Status of current permissions:
# l app/logs
total 632K
drwxrwxrwx+ 2 www-data www-data 4.0K Feb 3 09:35 ./
drwxrwxr-x+ 7 www-data www-data 4.0K Feb 2 16:11 ../
-rwxrwxrwx+ 1 www-data www-data 617K Feb 3 09:36 dev.log*
-rwxrwxrwx+ 1 www-data www-data 0 Feb 2 09:51 .gitkeep*
# l app/cache
total 12K
drwxrwxrwx+ 2 www-data www-data 4.0K Feb 3 10:02 ./
drwxrwxr-x+ 7 www-data www-data 4.0K Feb 2 16:11 ../
-rwxrwxrwx+ 1 www-data www-data 0 Feb 2 09:51 .gitkeep*
# getfacl app/cache
# file: app/cache
# owner: www-data
# group: www-data
user::rwx
user:root:rwx
user:www-data:rwx
group::r-x
mask::rwx
other::rwx
default:user::rwx
default:user:root:rwx
default:user:www-data:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
# getfacl app/logs
# file: app/logs
# owner: www-data
# group: www-data
user::rwx
user:root:rwx
user:www-data:rwx
group::r-x
mask::rwx
other::rwx
default:user::rwx
default:user:root:rwx
default:user:www-data:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
Any help would be greatly appreciated.
Upvotes: 0
Views: 87
Reputation: 101
Apparently, for some reason, not all the Apache processes were running through www-data and when it was trying to access the files they were accessed through the group www-data which had no write permissions.
By using the acl package, I only had to also add the permissions for the group www-data and it was working as expected.
setfacl -R -m g:www-data:rwX app/logs app/cache
setfacl -dR -m g:www-data:rwX app/logs app/cache
Upvotes: 1
Reputation: 4880
Make sure youve run the following commands from the project root directory. (the paths differ from the instructions if youve followed for symfony 3)
$ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache
If you're running Symfony 2.8+, then you need to change the last 2 lines to (to cater for the newer directory structure):
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
Upvotes: 0