您需要获得对缓存和日志文件夹的访问权限。为此,您可以按照此处给出的指示进行操作:http://symfony.com/doc/current/book/installation.html#configuration-and-setup http://symfony.com/doc/current/book/installation.html#configuration-and-setup
有多种方法,具体取决于您的操作系统(将 www-data 替换为您的 apache 用户):
如果支持 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
否则,如果它支持 setfacl (请参阅https://help.ubuntu.com/community/FilePermissionsACL 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
否则,将这些行放在 app/console、web/app.php 和 web/app_dev.php 的开头(不推荐):
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777