我在互联网上搜索过这个问题,但都没有帮助我。这个也没有:
chgrp apache /path/to/mydir
chmod g+w /path/to/mydir
我的服务器是centos 7。你能帮我吗?
尝试以下命令:
-
这将为您提供apache用户的名称
ps -ef | grep apache | grep -v grep
在大多数情况下,用户将是www数据。 -
进入/frontend/web文件夹后运行以下命令:
sudo chgrp www-data ./assets
和
>sudo chmod g+w ./assets/
你的问题会解决的。
我也有这个问题(在CentOS7中)。我试图更改所有者和组,但没有成功。最后,我关闭了selinux
,它工作了。
setenforce 0
如果你想永远关闭它,你可以更改/etc/selinux/config
文件:
SELINUX=disabled
我在ubuto实例中遇到了同样的问题,我喜欢这样做,并解决了问题
sudo chmod 777 /home/nicjccom/public_html/asset
还做了这个
sudo chgrp root /home/nicjccom/public_html/asset
你可以试试这个:
chcon -R -t httpd_sys_content_rw_t 'YOUR_PATH_HERE'
尝试以下命令
我正在授予www.中html文件夹的权限。我的html文件夹包含多个项目。
chgrp -R user html/
chmod -R g+w html/
chmod -R g+w html/
如果您使用的是php-fpm v7.4,并且您的所有用户/组都是正确的。你可以使用
systemctl edit php-fpm
[Service]
ReadWritePaths = /usr/share/webapps/yii2-basic/web/assets
并添加上面的配置,然后
systemctl restart php-fpm