views:

39

answers:

0

I have recently installed FC13 and am attempting to write a mechanism in my PHP code that caches gathered data into a specific directory (for our purposes here, let's call it /var/www/html/_php_resources/cache).

I copy my files over to the /var/www/html directory and then run chown -R apache:apache /var/www/html/* and chmod a+w /var/www/html/_php_resources/cache on the new data. For right now I am just using the global write permission for convenience. I will tweak the permissions later.

When I attempt to use the chmod or mkdir PHP functions I wind up with:

Warning: chmod(): Permission denied in /var/www/html/_include/php/CacheInit.php

or

Warning: mkdir(): Permission denied in /var/www/html/_include/php/CacheInit.php

Now, when I disable SELinux everything works just fine. The problem is that I would prefer not to disable SELinux and actually get the permissions set up correctly so that I can port it over to servers where someone does not have such explicit control.

As an example: my personal site host allows me to set read/write permissions on directories but will not allow for SELinux policy changes.


FYI:

  • uname -r = 2.6.34.7-56.fc13
  • *php -version * = PHP 5.3.3
  • rpm -qa | grep httpd = httpd-2.2.16-1.fc13

Does anyone have any suggestions?