Yii2 - Web 进程不可写目录 | frontend/web/assets

Yii2 - The directory is not writable by the Web process | frontend/web/assets

我在互联网上搜索过这个问题,但 none 对我有帮助。 这个也没有:

chgrp apache /path/to/mydir
chmod g+w /path/to/mydir

我的服务器是centos 7,你能帮帮我吗?

尝试以下命令

我正在向 www.My 中的 html 文件夹授予权限 html 文件夹包含多个项目。

chgrp -R user html/
chmod -R g+w html/
chmod -R g+w html/

尝试使用以下命令:

  1. 这将为您提供 apache 用户的名称。
    ps -ef | grep apache | grep -v grep

    在大多数情况下,用户将是 www-data。

  2. 运行进入/frontend/web文件夹后执行这些命令:
    sudo chgrp www-data ./assets

    sudo chmod g+w ./assets/

你的问题就迎刃而解了。

我在 ubuto 实例中遇到了同样的问题,我喜欢这个问题并解决了问题

sudo chmod 777 /home/nicjccom/public_html/asset

也这样做了

sudo chgrp root /home/nicjccom/public_html/asset

我也有这个问题(在 CentOS7 中)。我试图更改所有者和组,但没有用。最后,我关闭了 selinux,它起作用了。

setenforce 0

如果你想永远关闭它,你可以更改/etc/selinux/config文件:

SELINUX=disabled

你可以试试这个:

chcon -R -t httpd_sys_content_rw_t 'YOUR_PATH_HERE'

如果您使用的是 php-fpm v7.4,并且您所有的 user/group 都是正确的。 你可以使用

systemctl edit php-fpm

[Service]
ReadWritePaths = /usr/share/webapps/yii2-basic/web/assets

并添加上面的配置,然后

systemctl restart php-fpm