Upgrading Ubuntu to PHP 5.6.4

Posted January 7, 2015 130.8k views

My Ubuntu ownCloud 7.0.4 on 14.04 server is currently running PHP 5.5.9 and I am looking to upgrade to 5.6.4.
Are there any simple ways to upgrade ?

Thanks, Zombay.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
4 answers

I might be missing something here, but I would just use apt-get install php5 to upgrade to the latest version.

To upgrade to a newer version of PHP 5.6 on Ubuntu 14.04, you can use Ondřej Surý’s PPA. He is one of the Debian maintainers of the php5 package. To add the PPA and upgrade your packages, run:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5

Though remember to be careful when doing an upgrade of PHP outside of the normal distro repositories, some of the additional modules that you might rely on could be missing for that version. I generally recommend that you shouldn’t do such a major upgrade unless you specifically need a new feature from the newer release. Remember that Ubuntu backports security patches to their “Long Term Support” releases. So if your concern is making sure you have the most recent security fixes, simply updating your packages as normal should provide them.

The right way: Check

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip