无法使 files/dir 可由 php 写入

Can't make files/dir writable by php

我在 CentOS 7 机器上 PHP 使文件和目录可写时遇到问题

我已经搜索过网络和网站,但没有找到适合我的解决方案(我是 linux 的新手)。

到目前为止,我已经尝试了以下方法,关于为什么 file/dirs 仍然无法被 PHP 写入的任何想法?

sudo chown -R apache:apache ss/
sudo chmod -R g+rw ss/

sudo chmod -R 777 ss/

在使用 echo getmyuid().':'.getmygid(); 找到 id 后也尝试了以下命令;

sudo chown -R 1000:1000 ss/

我已经运行执行了以下命令

# egrep -i '^user|^group' /etc/httpd/conf/httpd.conf
User apache
Group apache

ls -Zd ss/
drwxrwxrwx. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 ss/

这似乎是一个 selinux 限制,尝试将上下文更改为 httpd_sys_rw_content_t 使用:chcon -R -t httpd_sys_rw_content_t ss/

此致,