April 19, 2019

Adding PHP to Apache on Linux - page 7

Supercharging Your Web Pages

  • December 23, 1999
  • By Ken Coar

To build PHP as a dynamic Apache module, build and install the Apache server itself using the APACI method (i.e., with the ./apache-1.3/configure script). This is because the PHP configure script needs to use one of the files that APACI installs.

To build PHP as a dynamic shared object (DSO), use the following sequence of commands:

    % cd ./php/php3/
    % rm -f config.status config.cache
    % make clean
    % ./configure --with-apxs=/usr/local/web/apache/bin/apxs other-options
    % make
    % /usr/local/web/apache/bin/apachectl stop   # shut down Apache entirely
    % make install
    % /usr/local/web/apache/bin/apachectl start  # restart Apache

When that's all done, your Apache server should be capable of handling PHP CGI scripts and PHP-enabled Web pages. And to upgrade just PHP from a new version, just repeat the process�without touching any other part of Apache.

For building PHP on Red Hat Linux 6.1 and using the Apache RPMs, fix a broken file provided by them before executing the above commands. See the "Fixing Red Hat 6.1's apxs Script" appendix in this article for the details.

Most Popular LinuxPlanet Stories