I get the following error on my Fedora 20 desktop running the LAMP stack when trying to use fopen()
Warning: fopen(/var/www/html/php/documents/orders.txt):
failed to open stream:
Permission denied in /var/www/html/php/processorder.php on line 76
The code I used is
$fp = fopen("$DOCUMENT_ROOT/php/documents/orders.txt", 'ab');
orders.txt has the following permissions
[root@localhost documents]# pwd
/var/www/html/php/documents
[root@localhost documents]# ls -l
total 4
-rwxrwxrwx. 1 byron web-content 12 Feb 21 12:33 orders.txt
I realise this question has been asked a number of times, but none of the solutions have worked for me. I am new to Linux/Fedora and to LAMP so I apologise if the error is borne out of ignorance.
Edit: Seems like SELinux was causing the problem, not sure how to overcome this in terms of changing settings in SELinux, so I disabled it.
To see whether SELinux is being enforced (I'm using Fedora 20) use /usr/sbin/sestatus .
To disable SELinux, configure SELINUX=disabled in /etc/selinux/config .
Seems like SELinux was causing the problem, not sure how to overcome this in terms of changing settings in SELinux, so I disabled it.
To see whether SELinux is being enforced (I'm using Fedora 20) use /usr/sbin/sestatus.
To disable SELinux, configure SELINUX=disabled in /etc/selinux/config.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.