Ubuntu – how can I install PHP5 manually on Ubuntu

apache-2.2MySQLphp5Ubuntu

I have a new VPN with Ubuntu server 10.04 LTS which came with Mysql 5.1 installed, that was not supporting Barracuda file formats, so I manually installed and configured Mysql 5.6. Which works perfectly so far.

Apache2 is working well too, so far (haven't been testing it a lot but seems stable).

Only thing is that PHP5 was not recognising the module for PDO, so i removed it.

Is there a way I can MANUALLY install PHP5 or any version of PHP on Ubuntu ?

If I do apt-get install php5 it says

root@vps:/etc# sudo apt-get install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
  php5: Depends: libapache2-mod-php5 (>= 5.3.10-1ubuntu3.8) but it is not going to         be    installed or
         libapache2-mod-php5filter (>= 5.3.10-1ubuntu3.8) but it is not going to be installed or
         php5-cgi (>= 5.3.10-1ubuntu3.8) but it is not going to be installed or
         php5-fpm (>= 5.3.10-1ubuntu3.8) but it is not installable
E: Broken packages 

Best Answer

Have you tried to download the PHP source code and compile?

get the source.

./configure --prefix=... --extra options of your choice
make
make install INSTALL_ROOT=/where_to_install

package it with ubuntu

modify httpd.conf to

LoadModule php5_module path/to/libphp5.so