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 http://old-releases.ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ intrepid-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu intrepid main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ 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
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
Now, starting apache2 using command gave error:
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/libphp5.so into server: libdb-4.8.so: 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 libdb-4.8.so. 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 libdb-4.8.so files in
Restarting web server: apache2apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
It worked !