The following is a simple installation scenario of a combination mod_perl and PHP build for the Apache server. We aren't going to use a custom installation directory, so Apache will use the default /usr/local/apache directory.

  1. Download the latest stable source releases:

    Apache:   http://www.apache.org/dist/httpd/
    mod_perl: http://perl.apache.org/download/
    PHP:      http://www.php.net/downloads.php
  2. Unpack them:

    panic% tar xvzf mod_perl-1.xx
    panic% tar xvzf apache_1.3.xx.tar.gz
    panic% tar xvzf php-x.x.xx.tar.gz
  3. Configure Apache:

    panic% cd apache_1.3.xx
    panic% ./configure
  4. Build mod_perl:

    panic% cd ../mod_perl-1.xx
    panic% perl Makefile.PL APACHE_SRC=../apache_1.3.xx/src NO_HTTPD=1 \
        USE_APACI=1 PREP_HTTPD=1 EVERYTHING=1
    panic% make
  5. Build mod_php:

    panic% cd ../php-x.x.xx
    panic% ./configure --with-apache=../apache_1.3.xx \
        --with-mysql --enable-track-vars
    panic% make
    panic# make install

    (mod_php doesn't come with a make test suite, so we don't need to run one.)

  6. Reconfigure Apache to use mod_perl and PHP, and then build it:

    panic% cd ../apache_1.3.xx
    panic% ./configure \
        --activate-module=src/modules/perl/libperl.a \
        --activate-module=src/modules/php4/libphp4.a
    panic% make

    Note that if you are building PHP3, you should use php3/libphp3.a. Also remember that libperl.a and libphp4.a do not exist at this time. They will be generated during compilation.

  7. Test and install mod_perl:

    panic% cd ../mod_perl-1.xx
    panic% make test
    panic# make install
  8. Complete the Apache installation:

    panic# cd ../apache_1.3.xx
    panic# make install

Now when you start the server:

panic# /usr/local/apache/bin/apachectl start

you should see something like this in /usr/local/apache/logs/error_log:

[Sat May 18 11:10:31 2002] [notice]
Apache/1.3.24 (Unix) PHP/4.2.0 mod_perl/1.26
configured -- resuming normal operations

If you need to build mod_ssl as well, make sure that you add the mod_ssl component first (see the next section).