I had to install PHP4 on a server in order to a test an application that will run under PHP4. Being a fan of Ubuntu, I chose Ubuntu 9.04 Jaunty Server edition as OS.
At first, I tried to install Apache using apt but subsequent compiling of PHP failed, perhaps due to different location of apache installation when using apt. Possibly, this can be fixed with some directives where to find certain Apache modules etc.
I then decided to install both latest Apache 2.2x and latest PHP4 (4.4.9) from scratch - compiling it. The process is quite simple as outlined on (php.net website):
- make yourself root
sudo su
- download both, Apache 2.2, PHP4
- decompress as necessary
gunzip filename.gz
or
tar -xvf filename.tar
- install “flex” and “bison”
apt-get install flex
apt-get install bison - configure Apache
cd httpxx
./configure --enable-so - install make if missing
apt-get install make
- compile Apache
make
make install - install apache2-threaded-dev
apt-get install apache2-threaded-dev
- Configure PHP
./configure --with-apxs2=/usr/bin/apxs2 --with-mysql
Please note this is the minimal configuration including mysql libraries, if you need more modules, you need to add them.If config fails because of missing libicu, install it using:
apt-get install libicu-dev
If you get xml2-config error message, install:
apt-get install libxml2-dev
- Compile PHP
make
make install - Copy over default php.ini, amend as necessary and add handler for php files to Apache config file (if necessary).
- You can also modify default index page to include index.php.