PHP on Apache: The Definitive Installation Guide Page 6

To build Apache from source (e.g., your Linux distribution package didn't provide the pieces necessary to add PHP), use the following commands as a quick-start. Download the latest released version of the Apache tarball and unpack it into a working directory. The top-level directory will then be ./apache-1.3, which matches assumption #1 described earlier.

    % cd ./apache-1.3
    % env CC=gcc CFLAGS="-O2 -Wall" \
    > ./configure --enable-shared=max --enable-module=most \
    > --with-layout=Apache --prefix=/usr/local/web/apache \
    > --with-port=80
    Configuring for Apache, Version 1.3.10-dev
     + using installation path layout: Apache (config.layout)
    Creating Makefile

    Creating Configuration.apaci in src
        [more configuration output]
    % make
        [lots of compilation output]
    % make install
        [lots more output describing file placement]
    % /usr/local/web/apache/bin/apachectl start

If there are no errors, you should now have a working Apache installation in the location that matches assumption #2 described earlier. It was written to work with dynamic modules rather than static ones, so build PHP as a dynamic module.

It's far beyond the scope of this article to give any more information about building Apache; it is about PHP, after all. If you'd like to see an article in this column about the details of building Apache, let me know.

Appendix B: Apache Source Components Provided by Linux Distributions

The following table shows the paths to the apxs and Apache source tree as supplied by the packages included with various Linux distributions. Note: Some of this information is inferential only, determined by examining the distribution kits rather than actually installing them. As a result, it may be inaccurate in some respects.

Distribution Version of Apache supplied Value for --with-apxs Value for --with-apache
Caldera OpenLinux 2.3 1.3.4 [note 1]
Corel 1.3.3 /usr/sbin/apxs [note 1]
Debian GNU/Linux 2.1 1.3.3 /usr/sbin/apxs [note 1]
Linux-Mandrake 6.1 1.3.9 /usr/sbin/apxs [note 2] [note 1]
Linux Pro 5.4 1.1.3, 1.2.5 [note 1]
Red Hat Linux 6.1 1.3.9 /usr/sbin/apxs [notes 2, 3] [note 1]
Slackware 7.0 1.3.9 /var/lib/apache/sbin/apxs /var/lib/apache
S.u.S.E. Linux 6.2 1.3.6 /usr/sbin/apxs [note 1]
TurboLinux 3.6 1.3.6 /usr/sbin/apxs [note 2] [note 1]


  1. This article was originally published on Aug 9, 2000

    Thanks for your registration, follow us on our social networks to keep up-to-date