apxs2 causes PHP install to barf under Suse 9.1 and Apache 2
At work, I’m forced to use a Windows XP machine largely because eBay’s addicted to Outlook, but also because that’s the type of thing you need to do to play nice within a big company. However, that doesn’t mean I can’t route around this pain, so I installed VMWare and loaded up Suse Linux 9.1 in a virtual machine. Now I can hack on PHP in a somewhat familiar environment.
I say “somewhat” because this is my first time using Suse. I used to run Red Hat and then I moved to Mac OS X on my home machine, so it’s taking me a little bit of time to get used to Suse. (I picked Suse because my boss has a copy of the Suse CDs lying around and I decided it was easier to install from CDs than over the Internet.)
For one, Suse has a package for Apache 2.0, but not for Apache 1.3, which is a first for me. Also, Suse has organized its httpd.conf file in such a way that all the master file does is Include a variety of specialized child configuration files. Unfortuntately, this breaks the PHP install process.
When you run PHP’s make install command, it kicks off a request to apxs2 to handle the Apache 2.0 specific stuff. apxs2 loads in your httpd.conf file and looks for a LoadModule directive, so it knows how it should format the line it should add to httpd.conf to enable PHP.
However, apxs2 only slurps in the master file. It doesn’t resolve any of the Includes, so it can’t find any LoadModule lines. This triggers an error, it dies, and as a result, PHP aborts the install.
I reported this as an Apache bug, but it was closed with a status of “Won’t Fix” because they don’t want reimplement the parser inside of apxs2.
From looking at the apxs2 code, I see there is a simple work around, which is to put a commented out LoadModule directive in the master file. apxs2 allows you to fool it into thinking it’s found a valid line, and you can go from there. You still need to fix up your configuration file, but at least the install doesn’t die.
However, when I tried to report this back to Suse, I was totally defeated. I could find no place anywhere on their Web site to access a bug database. Hum… That seems to defeat the notion of open source as a environment for parallel debugging. Oh well.
So I’ll blog it and hope that someone who Googles for “At least one LoadModule Directive already has to exist” will find this.
PS: Some further searching has uncovered that Debian was also affected by this issue. I don’t know it they’ve fixed it, however.
Comment by Mateus Pedroso on 4 August 2006:
Thanks dude !!!
I’m having the same problem in SuSE 9.1, Apache 1.33, but you helped me !!!
Thanks !!!!
Comment by jif on 28 February 2007:
Thanks dude..
I’m running a dev copy of Mac OS X 10.5, and compiling from source as none of the compiled binaries seem to take into account that leopard uses Apache2.
I seem to be hitting the same error, good to know its not a platform specific issue as such
Comment by Nick on 18 March 2007:
Thanks! I found this on google and just put:
# Dummy LoadModule directive to aid module installations
#LoadModule dummy_module /usr/lib/apache2/modules/mod_dummy.so
into my apache2.conf file from my fink installed apache2 in OS X and it worked perfectly.
Comment by spblat on 4 May 2007:
Thanks from an Ubuntu 7 user.
Comment by meeero on 11 May 2007:
that doesn’t work for me…it’s so frustrationg :/
Comment by Tim on 27 January 2008:
Genius! I had to put mine in httpd.conf not apache2.conf, but whatever who knows how much time this saved me?
Thanks!
Comment by Alan on 10 June 2009:
Another happy customer… I tried to resolve the problem myself by copying an existing LoadModule line from one of Debian Lenny’s config files but got impatient and googled it. ;)
Thanks
Comment by Larry on 29 December 2009:
I’m one of those who googled “at least one LoadModule directive” in quotes and ended up here. Worked perfectly on Ubuntu 9. thanks!
Comment by Lawrence on 27 May 2010:
Awesome! Thanks! Found via Google search as well and saved my butt! :)
-L