I am trying to update to php 5.4 in Ubuntu 12.04, and I can only get 5.3.6 using official repositories (using apt-get).
I'm not really sure how to do a manual update – I'm sorta new to ubuntu, but I need to play around with the new php features!
You could use a PPA to stay up-to-date with PHP. I use:
https://launchpad.net/~ondrej/+archive/php5-5.6 (for PHP 5.6)
https://launchpad.net/~ondrej/+archive/php5 (for PHP 5.5)
The PHP 5.5 repository it's now on 5.5 and also includes Apache 2.4 update. For Apache 2.2+ PHP 5.4 repository, see the bottom of the answer.
If you want use this PHP, do this:
If you don't have
For Ubuntu 12.10
Prepackaged latest PHP 5.4 now resides in separate PPA: ppa:ondrej/php5-oldstable
It will take some time for PHP 5.4 packages to make their way into Ubuntu, as there are an awful lot of dependency checks to do. Ubuntu 12.04 is now in beta so I doubt they'll upgrade it to PHP 5.4 (although I have no official or inside knowledge of this) -- it probably won't appear until Ubuntu 12.10 in October this year. If you want it sooner than that, you'll either have to find a third-party package or learn to build it yourself from the source code.
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?