fopen()给出权限被拒绝错误 - 尽管chmod 777

时间:2015-02-21 16:22:39

标签: php fopen file-permissions lamp fedora20

在尝试使用fopen()时,我在运行LAMP堆栈的Fedora 20桌面上出现以下错误

  

警告:fopen(/var/www/html/php/documents/orders.txt):

     

无法打开流:

     

第76行/var/www/html/php/processorder.php中的权限被拒绝

我使用的代码是

$fp = fopen("$DOCUMENT_ROOT/php/documents/orders.txt", 'ab');

orders.txt 具有以下权限

  

[root @ localhost documents] #pwd

     

/无功/网络/ HTML / PHP /文件

     

[root @ localhost documents] #ls -l <​​/ p>      总共4

     

-rwxrwxrwx。 1 byron web-content 12 Feb 21 12:33 orders.txt

我意识到这个问题已被多次询问,但没有一个解决方案对我有用。我是Linux / Fedora和LAMP的新手,所以如果错误是出于无知,我会道歉。

编辑:似乎SELinux导致了这个问题,不知道如何在更改SELinux中的设置方面克服这个问题,所以我禁用了它。

要查看SELinux是否正在执行(我使用Fedora 20),请使用 / usr / sbin / sestatus

要禁用SELinux,请在 / etc / selinux / config 中配置 SELINUX = disabled

1 个答案:

答案 0 :(得分:0)

似乎SELinux导致了这个问题,不知道如何在更改SELinux中的设置方面克服这个问题,所以我禁用了它。

要查看SELinux是否正在执行(我正在使用Fedora 20),请使用/ usr / sbin / sestatus。

要禁用SELinux,请在/ etc / selinux / config中配置SELINUX = disabled。