Tell SELinux to Give Apache Execute Access to PHP Files Outside Document Root

I found the solution with these two commands:

semanage fcontext -a -t httpd_sys_script_exec_t ‘/whatever/scripts(/.*)?’
 
restorecon -R -v /whatever/scripts/

That allows Apache to execute PHP scripts in that directory, and persists after a reboot, or system-wide relabeling.

Leave a Comment