Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

freekmurze's avatar

How to upgrade to the latest release php release?

Hi,

my forge provisioned server has php version 5.6.2. What is the best way to upgrade the php version to 5.6.6 Bonus points for not affecting all other installed software.

0 likes
5 replies
bashy's avatar

By not affecting other software, you mean not upgrading them?

sudo apt-get upgrade

// to see new version number
sudo apt-get -s install php5

// to upgrade it
sudo apt-get install php5

If it doesn't show the new version, it may be a version update so Ubuntu or other distros won't update it without doing

sudo apt-get dist-upgrade

Checking upgrade policy

sudo apt-cache policy php5
1 like
fideloper's avatar

I believe Forge is still using the Ondrej/php5-php5.6 PPA to get php 5.6 on Ubuntu 14.04. Looks like it has php5.6.6 built for Trusty, which means just @bashy said - sudo apt-get install php5 (install will also upgrade).

That may affect other software, so check what it will install/update before letting it through! (in general, it'll be safe to upgrade, however).

Here's what I see on my server (not forge, but very close match):

vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-cache policy php5
php5:
  Installed: (none)
  Candidate: 5.6.6+dfsg-1+deb.sury.org~trusty+1
  Version table:
     5.6.6+dfsg-1+deb.sury.org~trusty+1 0
        500 http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ trusty/main amd64 Packages
     5.5.9+dfsg-1ubuntu4.6 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Note that it says it's not installed. If you see the try, try php5-common:

vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-cache policy php5-common
php5-common:
  Installed: 5.6.6+dfsg-1+deb.sury.org~trusty+1
  Candidate: 5.6.6+dfsg-1+deb.sury.org~trusty+1
  Version table:
 *** 5.6.6+dfsg-1+deb.sury.org~trusty+1 0
        500 http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     5.5.9+dfsg-1ubuntu4.6 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

The *** means that's the installed version.

1 like
bashy's avatar

Yeah may vary depending on how it was setup. Can always run the --only-upgrade flag if you don't want to upgrade any packages not already installed.

sudo apt-get install --only-upgrade <packagename>

Please or to participate in this conversation.