如何保持 var/cache/prod 目录下的权限为 777(Symfony 5)

huangapple go评论55阅读模式
英文:

How to keep 777 on var/cache/prod (Symfony 5)

问题

我正在使用Symfony 5。当我清除缓存时,var/cache/prod文件夹失去了777权限。在我的生产服务器上,如果var/cache/prod文件夹不是777,我无法发送表单(错误500)。

如何修复这个问题?

英文:

I'm using Symfony 5. When I clear the cache, the var/cache/prod folder loses permission 777. On my production server, if the var/cache/prod folder is not in 777, I cannot send a form (error 500).

How can I fixed that ?

答案1

得分: 1

你需要为创建目录的进程所属的php脚本添加一个组,并授予该组对第二个变量的写权限。

如果你使用默认设置的php-fpm,那么你需要为拥有项目目录的用户添加www-data组,并设置权限如示例所示。

usermod -a -G www-data 你的用户名
chmod 664 /你项目的路径/var
英文:

You need to add a group for the directory creator to which the process running php scripts belongs and give rights to write to the second var of this group.

If you use php-fpm with default settings, then you need to add www-data groups for the user who owns the project directory and set permissions as in the example.


usermod -a -G www-data you_user_name
chmod 664 /path_to_you_project/var

huangapple
  • 本文由 发表于 2020年1月6日 21:03:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/59612640.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定