Geo*_*iuc 6 php caching symfony
我在生产中有一个Symfony项目,运行后sudo php app/console cache:clear --env=prod,文件夹的权限变为
drwxr-xr-x 11 root root 4096 Feb 29 15:08 prod
这不允许用户www-data(apache默认用户)再访问它.
如何清除缓存并将www-data读/写到缓存文件夹?
此外,运行php console cache:cleardev模式我得到了
dev.log文件并创建了以下权限:
The stream or file "../app/logs/dev.log" could not
be opened: failed to open stream: Permission denied-rw-r--r-- 1 www-data www-data 2840530 Feb 29 15:01 dev.log
请参阅http://symfony.com/doc/current/book/installation.html#configuration-and-setup中的 "设置权限" .
如果您使用Ubuntu,您可以使用 setfacl
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
Run Code Online (Sandbox Code Playgroud)
编辑:
$ rm -rf var/cache/* var/logs/* var/sessions/*
$ 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 chmod -R +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" var
$ sudo chmod -R +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var
Run Code Online (Sandbox Code Playgroud)
如果您的电脑上没有命令setfacl,则需要安装它;
sudo apt-get install acl
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1965 次 |
| 最近记录: |