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

走远了吗. 提交于 2019-11-28 13:43:32

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.

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!