Omega Omega - 6 months ago 28
PHP Question

symfony 2 cache:clear bug

I have installed Symfony 2.0.7 on Ubuntu 11.10. I have this problem:

1) I change permission of cache e logs dir:

chmod 777 -R cache

chmod 777 -R logs

and all function

2) then, I make:

app/console cache:clear
Clearing the cache for the dev environment with debug true

permissions of cache/dev change to 755 and symfony cannot write in that:

RuntimeException: Failed to write cache file "/var/www/myapp/app/cache/dev/classes.php".

in /var/www/myapp/app/bootstrap.php.cache line 1079
at ClassCollectionLoader::writeCacheFile() in /var/www/myapp/app/bootstrap.php.cache line 1017
at ClassCollectionLoader::load() in /var/www/myapp/app/bootstrap.php.cache line 682
at Kernel->loadClassCache() in /var/www/myapp/web/app_dev.php line 23

how can I solve this apparent bug in Symfony 2?


See the Setting up Permissions sidenote in the Configuration and Setup section. Use the ACL approach with setfacl.


sudo setfacl -R -m u:apache:rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:apache:rwX -m u:`whoami`:rwX app/cache app/logs

(where apache is your HTTPD user)