Oliver I
Oliver I

Reputation: 456

Setting permissions in Fedora Apache/PHP

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?

Upvotes: 0

Views: 2008

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799082

SELinux is preventing you from writing out the file. See the httpd_selinux(8) man page for ways to work with/around it.

Upvotes: 1

Related Questions