在 Fedora Apache/PHP 中设置权限
我正在构建一个 Fedora 服务器(现在在 VirtualBox 上)。它正在运行 Fedora 15。
我希望我的 PHP 脚本能够编辑其所在文件夹中的文件内容。PHP
脚本和文件位于 /home/user/public_html/
但是,当我调用“ file_put_contents("./theFile.txt")" 我收到一条错误消息,指出它无法打开流,权限被拒绝。
所以,我有:
- 将文件权限设为0777。
- 将文件夹权限设为0777。
- 将“apache”用户添加到“wheel”组。
- 将用户文件夹权限更改为 0771。
- 将 public_html 文件夹和文本文件的所有者更改为“apache:apache”。
我束手无策,我知道下一步该做什么。建议?
I am building a Fedora server (on VirtualBox right now). It is running Fedora 15.
I want my PHP script to be able to edit the contents of a file in the same folder it is in.
The PHP script and the file are in /home/user/public_html/
But, when I call "file_put_contents("./theFile.txt")" I get an error saying that it cannot open the stream, permission denied.
So, I have:
- Made the file permissions 0777.
- Made the folder permissions 0777.
- Added the "apache" user to the group "wheel".
- Changed the user folder permissions to 0771.
- Changed the owner of the public_html folder and the text file to "apache:apache".
I am at my wits end and I have idea what to do next. Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SELinux 阻止您写出该文件。请参阅
httpd_selinux(8)
手册页了解使用/绕过它的方法。SELinux is preventing you from writing out the file. See the
httpd_selinux(8)
man page for ways to work with/around it.