无法写入缓存文件"/var/www/myapp/app/cache/dev/classes.php";清除缓存时 [英] Failed to write cache file "/var/www/myapp/app/cache/dev/classes.php" when clearing the cache
问题描述
我已经在Ubuntu 11.10上安装了Symfony 2.0.7.我有这个问题:
I have installed Symfony 2.0.7 on Ubuntu 11.10. I have this problem:
我使用以下命令更改了cache
e logs
目录的权限:
I changed the permissions of the cache
e logs
directories using the following commands:
chmod 777 -R cache
chmod 777 -R logs
以及所有功能,正如我期望的那样.
and all functions as I was expecting.
然后我做了:
app/console cache:clear
使用debug true清除开发环境的缓存
Clearing the cache for the dev environment with debug true
缓存/开发的权限更改为755,并且symfony无法写入其中:
permissions of cache/dev change to 755 and symfony cannot write in that:
RuntimeException:无法写入缓存文件"/var/www/myapp/app/cache/dev/classes.php".
RuntimeException: Failed to write cache file "/var/www/myapp/app/cache/dev/classes.php".
在/var/www/myapp/app/bootstrap.php.cache第1017行的ClassCollectionLoader :: writeCacheFile()中 在/var/www/myapp/app/bootstrap.php.cache第682行的ClassCollectionLoader :: load()中 在/var/www/myapp/web/app_dev.php第23行的Kernel-> loadClassCache()中
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
我该如何解决Symfony 2中这个明显的错误?
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
(其中apache
是您的HTTPD用户)
(where apache
is your HTTPD user)
这篇关于无法写入缓存文件"/var/www/myapp/app/cache/dev/classes.php";清除缓存时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!