THIS IS OLD. GET OFF UBUNTU 12!
Essentially you will need to instruct Ubuntu to install from a non standard location (don’t worry it is safe).
This will also upgrade Apache to 2.4!
Step 1 Update your lists and install 2 new programs
apt-get update apt-get install python-software-properties apt-get install software-properties-common
Step 2 With the above two programs installed, add this guys ppa to your listing and then update once again
add-apt-repository ppa:ondrej/php5 apt-get update
Step 3 Make a backup copy of all you Apache Conf files.
Step 4 Install the latest PHP
apt-get install php5 /etc/init.d/apache2 restart
Step 5 Sort out you Apache conf files..
When you restart apache now you will likely get a few complaints.. conf files empty or none existent.. unfortunately this is a manual task of eliminating the complaint one at a time.
Using virtual hosts?
You are of course not there yet, Apache 2.4 conf file has new tweaks. If you moved your webroot away from the default you will have re-align this. The site-available config files all now require the extension “.conf”. Make sure all you previous settings, mod-rewrites… etc etc are still there (a spot the diff between your copied version and the new essentially).