I have a directory where shared PHP scripts are kept (the name is arbitrary, but it isn\'t /var/, /usr/, or anything that SELinux would have specific settings for):
/w
I use this with the executable programs I need to run from my PHP scripts and Apache
sudo chcon -v -t httpd_sys_script_exec_t my-executable
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.