PHP Installation as an Apache DSO Module

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
   ____    _    _     ____
  /    \  | |  | |   /    \     PHP Installation as an Apache DSO Module
 |  < > | | |__| |  |  < > |
 |  ___/  |  __  |  |  ___/     Document Date: 4/16/20002 
 | |      | |  | |  | |
 |_|      |_|  |_|  |_|         linux.dbw.org

Apache and PHP is by using Apache's DSO module. Apache supports adding modules on instead of embedding them in the httpd binary. This works well when you don't want to re-compile Apache each time a module is updated, or if you want to add on numerous modules for development purposes.

Compile Apache with DSO support

In Apache src directory (apache_1.3.14)

# ./configure --prefix=/usr/local/apache \
    --enable-module=so
    --enable-module=rewrite

$ make 
$ make install


Install PHP as a Module

In PHP src directory (php_4.0.3pl1)

# ./configure --with-mysql \
    --with-xml \
    --enable-track-vars \
    --with-apxs=/usr/local/apache/bin/apxs
# make 
# make install


This will install Apache and then install the PHP module into the appropiate Apache directories. The only difference in configuration from above is the module needs to be added in the Apache httpd.conf file. To add a module in Apache add the following line in the httpd.conf file (if it is not already there, sometimes the install script adds it for you)

LoadModule php4_module libexec/libphp4.so 

Be sure to following the rest of the configuration instructions above.

UPGRADING

When you configure PHP the configure options are saved in a file called config.nice (because it is nice of them to do this for you)

Here are some examples:

 cat /usr/local/src/php-4.4.0/config.nice
 #! /bin/sh
 #
 # Created by configure
 './configure' \
 '--with-mysql' \
 '--with-xml' \
 '--enable-track-vars' \
 '--with-apxs=/usr/local/apache/bin/apxs' \
 "$@"
 cat /usr/local/src/php-4.1.2/config.nice  
 #! /bin/sh
 #
 # Created by configure
 './configure' \
 '--with-mysql' \
 '--with-xml' \
 '--enable-track-vars' \
 '--enable-versioning' \
 '--with-apxs=/usr/local/apache/bin/apxs' \
 "$@"