php Yii2 - Web 进程不可写目录 | 前端/网络/资产

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34482597/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:01:55  来源:igfitidea点击:

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

phpwebyii2centos7

提问by Shaig Khaligli

I have searched this issue on internet but none of them helped me. Also this one doesn`t:

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

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

My server is centos 7. Can you help me?

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

回答by Sam

Try with following commands:

尝试使用以下命令:

  1. This will give you the name of apache user.
    ps -ef | grep apache | grep -v grep

    In most of the cases the user will be www-data.

  2. Run these command after going into the /frontend/web folder:
    sudo chgrp www-data ./assets
    and
    sudo chmod g+w ./assets/

  1. 这将为您提供 apache 用户的名称。在大多数情况下,用户将是 www-data。
    ps -ef | grep apache | grep -v grep

  2. 去到/前端/ web文件夹后运行这些命令:和
    sudo chgrp www-data ./assets

    sudo chmod g+w ./assets/

Your problem will be solved.

您的问题将得到解决。

回答by lizs

I have the problem too (in CentOS7). I tried to change the owner and group, but it didn't work. Finally, I closed the selinux, and it work.

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

setenforce 0

If you want to close it forever, you can change the /etc/selinux/configfile:

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

SELINUX=disabled

回答by Adiii

i have same issue in ubuto instance i did like that and issue solve

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

sudo chmod 777 /home/nicjccom/public_html/asset

and also did this

也做了这个

sudo chgrp root /home/nicjccom/public_html/asset

回答by Amol

Try the following command

试试下面的命令

I am giving permissions to html folder in www.My html folder contains multiple projects.

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

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

回答by user12192376

You can try this:

你可以试试这个:

chcon -R -t httpd_sys_content_rw_t 'YOUR_PATH_HERE'