I have installed httpd and php on a fresh centos7 and put some files into /var/www/html including an install script I wrote. This script needs to write to a config file in the /var/www/html directory. I created an empty config file and chowned it to apache:apache. However trying to fopen this file with write access always gives the error:
fopen(/var/www/html/config-local.php): failed to open stream: Permission denied
Doing research I read this quote: "in order to reach a file, ALL parent directories must be readable." So I checked and they are. /, /var, /var/www and /var/www/html are all readable by everyone.
So what's going on here? It appears that the apache user is some kind of specially restricted user since testing the same scenario with a standard user works fine.