Basically I am trying to restart a service from a php web page.
Here is the code:
I encountered the problem recently and the accepted answer above helped. However, I would like to post this answer to elaborate the same, so that the next person does not need to spend time much, like me!
Follow section 7 of the following link: https://wiki.centos.org/HowTos/SELinux.
Do grep with httpd_sys_script_t.
Basically the steps are:
# grep httpd_sys_script_t /var/log/audit/audit.log | audit2allow -M httpdallowsudo
# semodule -i httpdallowsudo.pp