Forum Moderators: phranque

Message Too Old, No Replies

Can't restart apache

Strange error message

         

universetoday

8:50 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



I'm trying restart apache and I get a strange error message from my (newly built) webserver.

[root@server public_html]# httpd restart
Syntax error on line 160 of /etc/httpd/conf/httpd.conf:
Cannot add module via name 'mod_php4.c': not in list of loaded modules

Any suggestions of how I can troubleshoot this?

ChadSEO

9:01 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



First off, what does line 160 of your httpd.conf file look like? Is it a LoadModule line like this:

LoadModule php4_module libexec/libphp4.so

If so, then you would want to check the file listed exists. Look for the ServerRoot parameter in the httpd.conf file, it should contain a path. Then append the LoadModule path to that. For instance, /usr/local/apache/libexec/libphp4.so. See if that file exists. If not, verify you have the php installed. It sounds like you did not compile apache from source, but installed a package, so PHP would probably be the same way. How you do this will depend on your flavor of linux.

Hopefully that will get you started.

universetoday

9:38 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



Thanks for your help so far.

Line 160 says:
AddModule mod_php4.c

I did a quick check and ran some sample PHP code, and it says that PHP 4.3.11 is running.

ChadSEO

9:54 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



What are the results if you run "httpd configtest"?

Do you only get that message if you try to restart? If you stop Apache, then start it, do you get any errors?

universetoday

10:03 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



I get the same error if I run the config command, and even if I try and stop it.

jatar_k

10:05 pm on Aug 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



do you actually have a LoadModule line as well?

If I am reading docs correctly, it can't add what isn't loaded but I am just sitting here doing searches on the error messages and looking at apache docs, I am no expert

ChadSEO

10:07 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



Try running "httpd -l", this will list the modules that are compiled in to Apache. Is mod_php4.c listed in there?

Also, if you comment out line 160, do you still get the error message?

coopster

10:09 pm on Aug 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Good point though, what version of Apache is this you are loading?

The AddModule and ClearModuleList directives no longer exist in Apache 2. These directives were used to ensure that modules could be enabled in the correct order. The new Apache 2.0 API allows modules to explicitly specify their ordering, eliminating the need for these directives.

universetoday

11:36 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



I'm using Apache 1.3.33.

When I do httpd -l I get the following:

Compiled-in modules:
http_core.c
mod_so.c
mod_frontpage.c
suexec: enabled; valid wrapper /usr/sbin/suexec

I'm also having trouble with SSIs, and I read somewhere that mod_includes needs to be running.

I don't have an exactly similar LoadModule, I've got this earlier on:
LoadModule php4_module modules/libphp4.so

When I comment out line #160, I get the following error:

Invalid command 'php_admin_flag', perhaps mis-spelled or defined by a module not included in the server configuration

I'll put it back.

universetoday

12:51 am on Aug 10, 2005 (gmt 0)

10+ Year Member



I'm actually starting to think that Apache's configuration is stopping at that line 160. Shouldn't I have way more modules running?

coopster

11:34 pm on Aug 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



httpd -l will output a list of modules compiled into the server. This will not list dynamically loaded modules included using the LoadModule directive.

Also, mod_include is a base module which means that it is compiled and loaded into the server by default, and is therefore normally available unless you have taken steps to remove the module from your configuration. Have you read the Apache docs regarding How do I enable SSI (parsed HTML)? [httpd.apache.org]

Statically compiled modules (those listed by 'httpd -l') do not need to be loaded via LoadModule. Your list doesn't show PHP so it lends to reason that you need the LoadModule [httpd.apache.org] directive.