[UPDATE]: I've recently used this approach on a 64-bit Ubuntu Server ( clean install) and it seems to have worked so that's good news for me and praise to Ondřej Surý who maintains that ppa!
If you're using a version of Ubuntu which has still got PHP 5.3++ in its repositories, this is what you need to do do upgrade PHP to version 5.4 and start using its new features:
add this PPA to your ubuntu sources:
sudo add-apt-repository ppa:ondrej/php5
now update the files per se:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
sudo: add-apt-repository: command not found
You need to install
sudo apt-get install python-software-properties
I used this to upgrade my PHP version at home. I was asked whether I wanted to replace my php.ini version with the one that came with the new upgrade. I said no.
Maybe because of that, some of the extensions I use (like apc and some pdo drivers) couldn't be found when I tried to run my apps after upgrading PHP like this.
I ended up needing to re-install apc, which is easy enough:
sudo pecl uninstall apc sudo pecl uninstall apc-beta sudo pecl install apc-beta