» IT tipps and howto's

How To: PHP make install under Debian (etch) with Apache 2

Last Update: 26. Nov. 2008

Since Apache 2.x, the config files are separated in different files and folders. Goodbye good old httpd.conf where every little config was written in. But it is not bad, once you know where which config is now written. But to the problem now! If you want to compile PHP on your Debian Etch machine, the 'make install' command will partly fail because the PHP make install command can't find a LoadModule in the httpd.conf. Why's that? Because Debian uses apache2.conf and the httpd.conf is now empty. Of course there are no LoadModule lines in it.
This is the error message appearing after the make install command:

chmod 644 /usr/lib/apache2/modules/libphp5.so apxs:Error: Activation failed for custom /etc/apache2/httpd.conf file.. apxs:Error: At least one `LoadModule' directive already has to exist.. make: *** [install-sapi] Error 1

To still be able to use the make install command (which installs the shared libraries which are needed by PHP scripts) do the following steps, found on http://bugs.php.net/bug.php?id=29157:

Furthermore, at least one other LoadModule directive must be present in /etc/apache2/httpd.conf before running 'make install', or apxs2 will fail to insert the line (it doesn't know where to put it), and the 'make install' fails. For this purpose I use:

# Commented-out dummy LoadModule directive for PHP's make install
# LoadModule dummy_module /usr/lib/apache2/modules/mod_dummy.so

That way, the PHP 5 LoadModule directive gets inserted right after the (commented-out) dummy line. After you made 'make install' be sure to delete the inserted line afterwards.