PDA

View Full Version : Apache won't start after installing PHP5



geeare1
1st June 2007, 02:21 PM
Hello, I'm using FC5 with Apache2 installed. I just installed PHP5 and now the server won't start. If I go to httpd.conf and remove the line:

LoadModule php5_module /usr/lib/httpd/modules/libphp5.so

the server will start. Does anyone know what I've done wrong and/or what I can do to fix it?

Thanks,
gr

pete_1967
1st June 2007, 02:36 PM
Start by telling us how did you install Php5?

Continue by checking your /var/log/httpd/error_log and if you don't understand any of error messages there, paste it here.

geeare1
1st June 2007, 10:01 PM
I've been following the instructions from a book titled, 'The Definitive Guide to MySQL 5'.
I downloaded the source code to /usr/local/src and used the following configure options:

./configure -prefix=/usr/local/php5 \
-with-apxs2=/usr/sbin/apxs \
-with-libxml-dir=/usr/lib \
-with-zlib -with-zlib-dir=/usr/lib \
-with-mysql=/usr -with-mysqli=/usr/bin/mysql-config \
-with-jpeg-dir=/usr -enable-exif \
-with-gd -enable-soap -enable-sockets \
-enable-force-cgi-redirect -enable-mbstring

then 'make' and 'make install'

I added '/usr/local/php5/include/php' to the php.ini-recommended file so it reads:

include_path = ".:/php/includes:/usr/local/php5/include/php"

and saved the file in /usr/local/php5/lib as 'php.ini'

This is the /var/log/httpd/error_log:
You probably don't need the whole thing but, just in case, I'm including everything. I started the server with the line: LoadModule php5_module /usr/lib/httpd/modules/libphp5.so removed from the httpd.conf file and then added it back and attempted to restart the server again so you could see the results.

[Wed May 30 14:21:41 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Wed May 30 14:21:41 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 30 14:21:41 2007] [notice] Digest: generating secret for digest authentication ...
[Wed May 30 14:21:41 2007] [notice] Digest: done
[Wed May 30 14:21:41 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Wed May 30 14:22:27 2007] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Wed May 30 14:22:28 2007] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Wed May 30 14:25:22 2007] [notice] caught SIGTERM, shutting down
[Wed May 30 14:31:56 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Wed May 30 14:31:56 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 30 14:31:56 2007] [notice] Digest: generating secret for digest authentication ...
[Wed May 30 14:31:56 2007] [notice] Digest: done
[Wed May 30 14:31:56 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Wed May 30 14:33:14 2007] [notice] caught SIGTERM, shutting down
[Wed May 30 14:43:37 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Wed May 30 14:43:37 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 30 14:43:37 2007] [notice] Digest: generating secret for digest authentication ...
[Wed May 30 14:43:37 2007] [notice] Digest: done
[Wed May 30 14:43:37 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Wed May 30 14:44:54 2007] [notice] caught SIGTERM, shutting down
[Wed May 30 14:45:59 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Wed May 30 14:45:59 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 30 14:45:59 2007] [notice] Digest: generating secret for digest authentication ...
[Wed May 30 14:45:59 2007] [notice] Digest: done
[Wed May 30 14:45:59 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Wed May 30 14:50:21 2007] [notice] caught SIGTERM, shutting down
[Thu May 31 21:30:22 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Thu May 31 21:30:22 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu May 31 21:30:22 2007] [notice] Digest: generating secret for digest authentication ...
[Thu May 31 21:30:22 2007] [notice] Digest: done
[Thu May 31 21:30:22 2007] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Thu May 31 21:30:22 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Thu May 31 21:30:35 2007] [notice] caught SIGTERM, shutting down
[Thu May 31 21:46:52 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Thu May 31 21:46:52 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu May 31 21:46:52 2007] [notice] Digest: generating secret for digest authentication ...
[Thu May 31 21:46:52 2007] [notice] Digest: done
[Thu May 31 21:46:52 2007] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Thu May 31 21:46:52 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Thu May 31 21:49:24 2007] [notice] caught SIGTERM, shutting down
[Fri Jun 01 08:05:03 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Fri Jun 01 08:05:03 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jun 01 08:05:03 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 01 08:05:03 2007] [notice] Digest: done
[Fri Jun 01 08:05:03 2007] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Fri Jun 01 08:05:03 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Fri Jun 01 08:10:08 2007] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Fri Jun 01 08:10:08 2007] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Fri Jun 01 08:11:19 2007] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Fri Jun 01 08:11:19 2007] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Fri Jun 01 08:12:34 2007] [notice] caught SIGTERM, shutting down
[Fri Jun 01 08:12:38 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Fri Jun 01 08:12:38 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jun 01 08:12:38 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 01 08:12:38 2007] [notice] Digest: done
[Fri Jun 01 08:12:38 2007] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Fri Jun 01 08:12:38 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Fri Jun 01 08:12:44 2007] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
[Fri Jun 01 08:27:08 2007] [notice] caught SIGTERM, shutting down
[Fri Jun 01 15:47:42 2007] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0
[Fri Jun 01 15:47:42 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jun 01 15:47:42 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 01 15:47:42 2007] [notice] Digest: done
[Fri Jun 01 15:47:42 2007] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Fri Jun 01 15:47:42 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations
[Fri Jun 01 15:50:32 2007] [notice] caught SIGTERM, shutting down

Thanks very much for your help,
gr

geeare1
1st June 2007, 10:35 PM
I changed the security settings and now I get the following message when I attempt to start the server:

[root@bellsouth ~]# /etc/init.d/httpd start
Starting httpd: httpd: Syntax error on line 205 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
[FAILED]

This is what httpd.conf looks like, line 205 is the LoadModule php5_module line:

#
# The following modules are not loaded by default:
#
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule asis_module modules/mod_asis.so
LoadModule php5_module modules/libphp5.so

#AddType application/x-httpd-php .php
#

Does anyone see the syntax error? libphp5.so is in the modules directory.

Thanks,
gr

pete_1967
1st June 2007, 11:22 PM
I don't have much time to go to great detail now but:

First install SELinux Troubleshooter - it's great help in sorting out SELinux denials. (`yum install setroubleshoot`)

"/etc/httpd/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied"

Is SELinux denial. I can't remember the context PHP needs to run under (could be httpd_unified but don't count on that), but SELinux Troubleshooter will flag it for you and show correct context.

If above doesn't work, try disabling SELinux and try again (restart Apache).

Second problem you have is that you are mixing source buillds with RPM installs (unless you also compiled Apache and MySQL from source). You should do either or rather than try mixing and matching (rpm Apache and source Php).

FC6 comes with php 5.1.6 and unless you have good reason to build from source, you're better off by using rpms (`yum install php`)

I can't remember if Php source came with uninstaller but you can easily do it by following build log and delete files it lists. Also you should check that you don't also have php installed from rpm (`rpm -qa php` will show it quickest) already meaning that in essence you're having 2 versions installed (if so, you need to decide which one to keep).


This should get you started. If you still have problems, post back and don't forget to paste relevant logs (in case os SELinux, you should also have an audit log showing what it has done).

geeare1
3rd June 2007, 01:55 AM
Hi, Thanks very much for your help and for the tip about the troublshooter. As it turns out changing the selinux settings to permissive fixed everything. Thanks again.

All The Best.
gr

pete_1967
3rd June 2007, 03:24 AM
Hi, Thanks very much for your help and for the tip about the troublshooter. As it turns out changing the selinux settings to permissive fixed everything. Thanks again.

All The Best.
gr

Good to hear you got it working, now instead of setting SELinux to permissive, turn it back to enforcing and use Troubleshooter to set correct context (when it throws up denial message it also shows how to change context rule to allow program execution).

You only have to do it once but it'll mean that your system remains as safe as possible.