PHP5 installation & integration with Apache2

This tutorial is meant for people who are want PHP5 on their Ubuntu computer along with Apache2, but can’t seem to make it happen. I’ll just explain it all as it happened to me.

I have an old pc running BackTrack 4 R2 which is used as a MySQL server. It’s Ubuntu version is Intrepid, which isn’t officially supported anymore. As it happened, we needed to run a small webserver on it with PHP support. Although Apache2 is installed and running fine, server wouldn’t handle PHP files and will just offer them as download instead of processing them.
Now the first step is to install PHP.

Now, as I said before, my Ubuntu version is old and not supported, I had to manually change my repository list at /etc/apt/sources.list and add the following lines:

deb intrepid main restricted universe multiverse
deb intrepid-updates main restricted universe multiverse
deb intrepid-security main restricted universe multiverse
deb-src intrepid main restricted universe multiverse
deb intrepid main restricted 
deb-src intrepid-updates main restricted multiverse universe

That enables updates and installs via aptitude, apt-get way. Then   I install php5 via command

apt-get install php5 

but the process doesn’t work due to some missing dependencies errors and what not. There are other commands like

apt-get install libapache2-mod-php5

and some others to install missing dependencies, but they don’t work. At this time, I came across this link and upgraded Ubuntu version by running these commands: (click on link to read what each command does in detail)


sudo aptitude install update-manager-core update-manager 

sudo aptitude install linux-image-generic linux-headers-generic 

sudo aptitude update && sudo aptitude safe-upgrade 

sudo do-release-upgrade 


After a reboot I ran apt-get update command just in case

Installing php5 using apt-get wasn’t working even then, so I had to download the setup archive from this link and install using commands in following order:



make test   and

make install

Now, starting apache2 using command  gave error:


/etc/init.d/apache2 start
Starting web server: apache2apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/ into server: cannot open shared object file: No such file or directory


Disabling php5 using command a2dismod php5 is helpful in a way, as the Apache starts normally, but enabling it using a2enmod php5  brings up the same problem again. Analysing the error message, I realised that it had something to do with file  I had versions 4.7 and 4.6 on my PC, but not version 4.8. So, I downloaded the file from this link . Trouble is that it’s in RPM format and I had to install another program called rpm2cpio using apt-get, then run:


rpm2cpio db48-4.8.30-2.puias6.i686.rpm | cpio -idmv

which copied files in


Then run

/etc/init.d/apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName


It worked !