Fix for: cannot restore segment prot after reloc: Permission denied

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: