Recipe for building php-2.0.1 with Apache-1.3.0 and PHP 3.0

First make sure you have the current source tarballs for all three packages. Start in the Apache directory:

cd apache_1.3.0/src
./Configure
This is done so that a couple of auto-generated header files will be there when you configure PHP 3.0.

Next, follow the standard installation directions for PHP 3.0. Something like:

cd php-3.0
./configure --with-apache=../apache_1.3.0
make
make install
Now the tricky part. PHP/FI 2.0 was written long before Apache-1.3.0 was released, so it isn't quite a smooth as it could be. There is a bug in mod_php.module.in. The trailing " is missing. Edit this file and add that. Then run the ./install program. During the install it asks you for the Apache include directory. It will be something like <path>/apache_1.3.0/src/include. After the install program has finished you will need to edit 3 files. First, edit src/php.h and down around line 95 you will find a line that says:
#include "httpd.h"
Just before this line, add a line that says:
#include "compat.h"
Do the same thing in mod_php.c. Just before the #include "httpd.h" line add #include "compat.h"

The third file you need to edit is src/Makefile. On the CPPFLAGS line around line 47 you will see a line which among other things has a -I followed by the Apache include directory you specified earlier. Add another -I entry with the same path but instead of ending in src/include it needs to end in src/os/unix. For example, on my system this line looks like this after fixing it:

CPPFLAGS = -I./regex -I. -I/usr/local/include/mysql -DHAVE_LIBMYSQL=1 \
-I/export/home/rasmus/apache_1.3.0/src/include -I/export/home/rasmus/apache_1.3.0/src/os/unix \
-DFILE_UPLOAD -DAPACHE=1 -DAPACHE_NEWAPI=1 -DPHPSENDMAIL=1 -DSENDMAIL=\""/var/qmail/bin/sendmail -t"\" \
$(DEBUG)
Now you can run make. It will copy a bunch of files to the Apache src/include directory when it is finished. That is the wrong place for these files. You should copy libphp.a and mod_php.* to the Apache src/modules/extra directory.

Back to the apache_1.3.0/src directory. Edit the Configuration file and at the end add these two lines:

AddModule modules/php3/libphp3.a
AddModule modules/extra/mod_php.o
The type: ./Configure followed by make and you should end up with an httpd binary that includes both the PHP/FI 2.0 and the PHP 3.0 module. You can then set your AddType lines in src.conf to poing .phtml files at PHP/FI 2.0 and .php3 files at PHP 3.0, for example.
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php3 .php3