【发布时间】:2018-03-23 21:51:54
【问题描述】:
我在 centos 7 服务器中遇到下一个错误
我查看了类似的问题,说这是因为 SELinux 不允许 httpd 写入我的 /home 文件夹,我尝试更改文件夹的所有者但没有成功;尝试将上下文 (chcon) 更改为我的 /home 的 httpd_sys_rw_content_t 并出现相同的错误;尝试禁用 SELinux,错误仍然存在;并在文件httpd.conf 中将User 和Group 从apache 更改为test 这也不起作用。我的服务器是:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
和
Linux localhost 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
当我以用户 test 的身份从 php -a 执行 move_uploaded_file() 时,它正常工作,我发现问题出在用户 apache
【问题讨论】:
-
/home/test 和 /home 的权限是什么?
-
您是否尝试过 chown -R test:apache /home/test 然后在 /home/test 上授予 750 权限?
-
嗨@jawbonewalk,感谢我尝试
chown -R test:apache /home/test并授予750文件夹/home/test权限的评论,但我看到了同样的错误。我的/home/test的权限是 700 和/home755 -
您是否将 /etc/httpd/conf/httpd.conf 更改为指向您的文件夹?
-
是的,我在我的 httpd.conf 中添加了我的文件夹,但我终于找到了一个解决方案,它是关于文件夹
/home/test/images/和上层文件夹/home/test的所有者,因为所有者必须是apache 和小组也是,感谢@jawbonewalk 的指导