server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

Today I have faced a weired problem. I have compiled apache-php so many times till today. BUt havn’t faced this kind of problem.

Installation of both packages were fine without any error. As soon as I completed installation, I stopped apache, but I cant. The following error appeared.

” Syntax error on line xxx 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 ”

After googling for whole day I have found the solution. Actually this is NOT a syntax error in the httpd.conf file in spite of the error message – but it does (correctly) point to a line number at which it had an issue.And in this case the issue is … the security setting for SELinux that was selected at the time the operating system was installed.

To get past the problem and allow the PHP Install to complete, we need to just turned enforcement off ..

e.g. [root@ superbox ]# setenforce 0

[root@superbox]# /usr/local/apache2/bin/apachectl start

Gr8 ….Its started……..

What this command do exactly?

Setenforce change the mode of SELinux is running in.
Synopsis: “setenforce [ Enforcing | Permissive | 1 | 0 ]”

Use Enforcing or 1 to put SELinux in enforcing mode.  Use Permissive or
0 to put SELinux in permissive mode.  You need to modify /etc/grub.conf
or /etc/selinux/config to disable SELinux.

By-Vj

Advertisements
This entry was posted in LAMP, Linux and tagged , , , , , , , . Bookmark the permalink.

2 Responses to server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

  1. Hi, interesting post. I have been pondering this topic,so thanks for posting. I will certainly be coming back to your blog.

  2. Kos says:

    Thanks a lot

    its very helpful for the beginers

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