Fix for: cannot restore segment prot after reloc: Permission denied
March 27, 2013 Leave a comment
Just got this:
thebes# apachectl configtest
httpd: Syntax error on line 62 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
This is an SELinux issue. As you can see the security context “type” is set to usr_t
:
thebes# ls -lZ /usr/local/apache2/modules/libphp5.so
-rwxr-xr-x root root user_u:object_r:usr_t /usr/local/apache2/modules/libphp5.so
Change it to textrel_shlib_t
with:
chcon -u system_u -r object_r -t textrel_shlib_t /usr/local/apache2/modules/libphp5.so
And it works fine:
thebes# apachectl configtest
Syntax OK