[CentOS] SELinux permissions for apache

Thu Jan 22 18:09:01 UTC 2015
Tim Dunphy <bluethundr at gmail.com>

Hey all,

 I have a simple php app working that writes some info to a text file. The
app will only work correctly if SELinux is disabled. If it's enabled and
try to use the app, it fails. It seems that SELinux is denying the app
ability to write to the text file.

So I tried running the following command:

chcon -R -t httpd_sys_content_t /var/www

And tried veriying the command with the following:

ls -RZ /var/www

And everything seems to be in order. For example I see:

-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0

But the app stil won't function correctly unless SELinux is set to off.
What can I do to get it work with it enabled?

GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B