Zombay
By:
Zombay

Upgrading Ubuntu to PHP 5.6.4

January 7, 2015 104.2k 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.

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.

  • Yes apparently my PHP version is vulnerable. I have all other packages updated, so I wouldn't be vulnerable ?
    http://www.cvedetails.com/vulnerability-list/vendor_id-74/product_id-128/PHP-PHP.html

  • @Zombay As of right now, the version of PHP included in Ubuntu 14.04 is 5.5.9+dfsg-1ubuntu4.5 This has quite a few security patches backported to it. Notice the "distro" version appended to the "upstream" PHP version number. You can see the full changelog for this version showing what patches are applied here:

    http://changelogs.ubuntu.com/changelogs/pool/main/p/php5/php5_5.5.9+dfsg-1ubuntu4.5/changelog

  • So you don't think it would be necessary to upgrade my PHP version ? I'm running an ownCloud server.

  • You should be ok as long as you keep your version up to date with the latest security update provided by Ubuntu. In many cases a distribution will backport security updates for a package rather than forcing an update to a completely new version.

  • Okay. Then I won't update my PHP version. How likely is it that PHP 5.5.9 will be included in the next Ubuntu release ?

  • I have try this method on my VPS Ubuntu 14.04 using VestaCP. Its working fine.

    I can see 16 php module will be upgraded and 3 new php module will be installed. Before this my php version is 5.5.9 and there is total 20 php module on 5.5.9 version. Maybe around 4 module is not upgraded.

    I have to upgrade my php to 5.6 since any Wordpress version starting from 4.6 required php 5.6.x. Its a must for Wordpress user.

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
  • after that, you may need to:

    sudo a2dismod php5
    sudo a2enmod php5.6
    sudo service apache2 restart
    
Have another answer? Share your knowledge.