My Symfony 2 website has recently been giving me problems when I try to clear the cache. I type the following command in the terminal:
php app/console cache:clea
You need to get your access rights on both cache & logs folders. To do that, you can follow the indications given here : http://symfony.com/doc/current/book/installation.html#configuration-and-setup
There are several ways, depending on your OS (replace www-data with your apache user):
If it supports chmod +a:
$ rm -rf app/cache/*
$ rm -rf app/logs/*
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
Else, if it supports setfacl (see https://help.ubuntu.com/community/FilePermissionsACLs):
$ sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
Else, put those lines in the beginning of app/console, web/app.php & web/app_dev.php (not recommended):
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777
in Symfony3 folders with cache moved from app
to var
, so the command will be:
$ rm -rf var/cache/*
$ rm -rf var/logs/*
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
You need to get your access rights on both cache & logs folders. To do that, you can follow the indications given here :