Open hieuhtr opened 7 years ago
Stack: Nginx - PHP7-FPM - Symfony Nginx error log:
Runtime Exception : Unable to create the cache directory (var/app/cache/dev). ...
Root cause: One important Symfony requirement is that the var directory must be writable both by the web server and the command line user.
var
Solutions:
acl
$ sudo apt-get update $ sudo apt-get install acl $ 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 -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
./var
$ sudo chown -R www-data /var/www/symfony/var
Remember to restart php service after change
https://symfony.com/doc/current/setup/file_permissions.html
Problem:
Stack: Nginx - PHP7-FPM - Symfony Nginx error log:
Root cause & solutions:
Root cause: One important Symfony requirement is that the
var
directory must be writable both by the web server and the command line user.Solutions:
acl
and grant the needed permissions./var
Remember to restart php service after change
Reference:
https://symfony.com/doc/current/setup/file_permissions.html