Problem installing Apache 2 and PHP 5 in Linux

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
aleetk
Forum Newbie
Posts: 5
Joined: Thu Oct 06, 2005 4:10 am

Problem installing Apache 2 and PHP 5 in Linux

Post by aleetk »

Hi,

I've got problems trying to get PHP working and would like some help.

Linux Distribution: Fedora Core 4
Apache version: 2.2.0
PHP version: 5.1.2

I actually followed the instructions carefully under the INSTALL file for both Apache and PHP. However, once I try to start the apache server using apachectl start, I get an error saying:

httpd: Syntax error on line 53 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.


Has anyone encountered this problem and know how to fix it? Please let me know.

Thanks!
r101
Forum Newbie
Posts: 4
Joined: Sat Apr 15, 2006 4:35 am

Post by r101 »

Hey I also have the exact same problem!!!
I am running FC5 which came with an apache installation which i have had to uninstall and recompile for various reasons.
I found that disabling selinux by running the command

setenforce 0

allows the php5 module to load. but dont we need selinux?

ive also found this on a few other forums. running this command in the /usr/local/apache2/modules/ directory as root

chcon libphp5.so -t shlib_t
(this doesnt work for me)

the other solution i have seen was to totally reinstall FC4/5 without apache.
that would be the most inconvenient fix i could possibly think of as time is money and dont have time to rebuild a whole system again and pay an ISP to reimage.

Im stuck for solutions... can anybody help????


Thanks
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Might want to chmod /usr/local/apache2/modules/libphp5.so so that everyone has Read permissions.

Login as root, try this...

chmod 644 /usr/local/apache2/modules/libphp5.so

If that doesn't work, make sure the file exists, otherwise edit httpd.conf and comment out the line trying to load the module, but if you do that PHP probably won't work.
r101
Forum Newbie
Posts: 4
Joined: Sat Apr 15, 2006 4:35 am

Post by r101 »

agtlewis wrote:Might want to chmod /usr/local/apache2/modules/libphp5.so so that everyone has Read permissions.

Login as root, try this...

chmod 644 /usr/local/apache2/modules/libphp5.so

If that doesn't work, make sure the file exists, otherwise edit httpd.conf and comment out the line trying to load the module, but if you do that PHP probably won't work.
The file does exist and commenting out the line in httpd.conf will stop PHP from trying to load but Ive tried setting the permissions and changing the user group setting of the file but still no joy :(
r101
Forum Newbie
Posts: 4
Joined: Sat Apr 15, 2006 4:35 am

Post by r101 »

I notice that when i run the startup script i get this

Executing /etc/rc.d/init.d/httpd start ..


Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: libgmp.so.3: cannot enable executable stack as shared object requires: Permission denied
[FAILED]

i cant find anything on google or anywhere about this error.. any help please???
r101
Forum Newbie
Posts: 4
Joined: Sat Apr 15, 2006 4:35 am

PROBLEM SOLVED!!

Post by r101 »

It turns out that its just a simple configuration option with selinux to get this working.

by going to the /usr/local/apache2/modules directory and running the command

chcon libphp5.so -t texrel_shlib_t

apache and php started fine while selinux was still enabled!

i found this information on the selinux website
http://www.nsa.gov/selinux/list-archive/0602/14757.cfm

I hope this helps others!!! took me 3 days to work this out 8O
Post Reply