SELinux prevented httpd(usr/sbin/httpd) write access to /var/www/html/bookings/templates_c

AssamGuy picture AssamGuy · Dec 28, 2012 · Viewed 10k times · Source

I am using a framework which uses Smarty template engine. It works fine in Windows, but when I tried to run it in LAMP server, I got a message like SELinux has detected suspicious behaviour on your system. The whole error message i have attached. Please guide me what to do. Thanksimage

Answer

favoretti picture favoretti · Dec 28, 2012

You can allow it by using setsebool -P httpd_unified=1

Normal SELinux settings for http to work with PHP more or less properly are:

setsebool -P httpd_enable_cgi on
setsebool -P httpd_unified on
setsebool -P httpd_builtin_scripting on

Otherwise you can use

getsebool -a | grep httpd

To get a list of httpd-related EeLinux options and tweak to your personal taste.