简体   繁体   English

不能使文件/目录可写的PHP

[英]Can't make files/dir writable by php

I'm having issues making files and directories writeable by PHP on a CentOS 7 machine 我在使文件和目录在CentOS 7计算机上可被PHP写入时遇到问题

I've already search the net and the site but haven't found a solution that works for me (I'm fairly new to linux). 我已经搜索了网络和站点,但是没有找到适合我的解决方案(我对linux还是很陌生的)。

So far I've tried the following, any ideas on why the file/dirs are still not writeable by PHP? 到目前为止,我已经尝试了以下方法,关于为什么文件/目录仍然无法用PHP编写的任何想法?

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

sudo chmod -R 777 ss/

Also tried the following command after finding the id with echo getmyuid().':'.getmygid(); 在使用echo getmyuid()找到ID后,还尝试了以下命令。':'。getmygid();

sudo chown -R 1000:1000 ss/

I've run the following commands 我运行了以下命令

# 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/

It seems to be a selinux restriction, try changing the context to httpd_sys_rw_content_t using: chcon -R -t httpd_sys_rw_content_t ss/ 似乎是selinux的限制,请尝试使用以下命令将上下文更改为httpd_sys_rw_content_t: chcon -R -t httpd_sys_rw_content_t ss/

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM