Head’s up! Security support for PHP 5.4 has ENDED. If you really need to use PHP 5.4 be aware that you are doing so at your own risk. Not just that, but Ubuntu 10.04 LTS is also at END OF LIFE. For real, you should be upgrading ASAP.

I’ve previously posted about upgrading to PHP 5.5.x on Ubuntu 12.04 LTS but what about my friends still on the even older Ubuntu Long Term Service release that’s still supported, 10.04 LTS. That particular version’s server release will remain supported until April 2015, with more than a year left at the time of this writing! Even after support stops, I’m sure a lot of folks will continue to use 10.04 well after it’s expiration.

Ubuntu 10.04 LTS has PHP version 5.3.2 when fully up to date and can easily be upgraded to PHP 5.4. Unfortunately, the wonderful PPA that hosts the latest versions of PHP does not support “lucid” so we aren’t able to upgrade to the bleeding edge version. Going from PHP 5.3 to 5.4 is still pretty painless.

First let’s make sure you have python-software-properties so we can add the PPA:

sudo apt-get update && sudo apt-get install python-software-properties

Next we’ll add the PPA for PHP 5.4:

sudo add-apt-repository ppa:ondrej/php5-oldstable

And then upgrade!

sudo apt-get update && sudo apt-get dist-upgrade

Instant presto, you are now running PHP 5.4.25 (the latest version of the 5.4 branch at the time of this writing) which introduces many improvements over PHP 5.3 as well as shorthand arrays!

As with most of my walkthroughs, I used DigitalOcean to spin up a fresh server to test the steps on. If you’re looking for an affordable cloud hosting company and would like to help support the sight then please check out DigitalOcean with plans starting at $5 a month!

I tend to stick to Ubuntu for all of my how to posts but have been thinking about branching out and posting about other distributions of Linux as well. What non-Ubuntu distro are you using these days?

OH and expect some posts on PHP 5.6 in the near future :)