I recently upgraded php for my web server. Just wanna share the process with you. Its just few steps to upgrade php version 5.3.10 to the lasted 5.4.1 . I did it in my ubuntu 12.04 LTS system

Add the PPA for php5 latest..

sudo add-apt-repository ppa:ondrej/php5

And install it..

sudo apt-get update

sudo apt-get install php5

Add also to add the Graphics library to dynamically manipulating images in webpages. Install the php5-gd packages.

The step are

# apt-get install php5-gd


$ sudo apt-get install php5-gd