We help IT Professionals succeed at work.

Invalid Command 'LoadModule'

Mark asked
Medium Priority
Last Modified: 2013-12-13
I am trying to configure Apache 1.3.33 on Linux to enable php. I believe I have followed the instructions correctly. When I restart httpd I get:

Syntax error on line 211 of /usr/local/apache/conf/httpd.conf:
Invalid command 'LoadModule', perhaps mis-spelled or defined by a module not included in the server configuration

Line 211 is:

LoadModule php4_module         libexec/libphp4.so

I have tried multiple variations in this including:

LoadModule php4_module         /usr/libexec/apache/libphp4.so

which is where the .so was originally located. I then copied libphp4.so to /usr/local/apache/libexec directory. I can't get either to work. What's wrong?
Watch Question

the correct  one is
LoadModule php4_module        libexec/libphp4.so
just make sure that the libphp4.so is located under /usr/local/apache/libexec  NOT /usr/libexec/apache

Try this LoadModule php4_module /usr/local/apache/libexec/libphp4.so

it might work :)

Also this might help you if you might configured Php wrong


you missed --enable-module=so option when you started configure
or you have no

AddModule mod_so.c

in your httpd.conf

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


WaielEid: libphp4.so is located under /usr/local/apache/libexec. I tried:
LoadModule php4_module /usr/local/apache/libexec/libphp4.so
but that didn't work either, same error. The link you gave is where I was following installation instruction. Like I said, I think I've done the right steps.

ahoffmann: I do have the AddModule mod_so.c in the conf file in fact I have:
AddModule mod_php4.c
immediately following the LoadModule.

What do you mean --enable-module=so? Is this an Apache build directive? If so, when I do httpd -L it does list LoadModule as an available configuration directive.

> Is this an Apache build directive?

>  If so, when I do httpd -L it does list LoadModule as an available configuration directive.
then you should have mod_so loaded, you can check with  httpd -l  or with
(if enabled)

I guess you have a httpd.conf in wrong format, somehow
Check with od or vi if there're some uncommon chracters around this line


Ah ha! when I do httpd -l mod_so.c is *not* listed. Do I have to rebuild Apache or can I load this via a httpd.conf directive? Why would it list LoadModule as an available configuration directive (httpd -L) if mod_so was not configured?


OK, I rebuilt apache with --enable-module=so. To my httpd.conf I added:

LoadModule php4_module  /usr/local/apache/libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

However, it would not run and said:

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

That seemed wrong. The only "Order" command I have is Order allow,deny in the <directory> sections, so I figured maybe the ClearModuleList was clearing things I didn't want cleared ... dunno. So I removed the ClearModuleList and httpd ran, but gave me "mod_php4.c already loaded". So I removed the AddModule directive.

Things *seem* to be running. I was able to use my browser to open the test <? phpinfo(); ?> in a php file.

Do I need these ClearModuleList and AddModule directives? Why would the instructions tell me to use them if they don't work. I must be doing something else wrong.
sounds like you messed up your httpd.conf
how about starting with the original one which comes with apache, if that works add the PHP stuff and try again


Except for adding ssl, I basically am using the original conf. Perhaps it has to do with where in the conf I've placed the ClearModuleList and AddModule directives. In any case, it seems to be working, so I'll just leave well enough alone.  Thanks
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.