PHP update needed or not ?

Posted February 4, 2016 7.5k views

I currently have following PHP version:
PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)

Should I update it to 5.6.17 and how can I do this? I have already tried apt-get update & apt-get upgrade without effect to PHP version.

I’m runnning Ubuntu 14.04.3 LTS.

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
5 answers

Is there any reason you want to update? If not, you shouldn’t do it.

Nothing other but security reasons? I think old PHP versions can have bugs which affect security.

  • Ubuntu and other major distributions usually backport security updates, providing the security fixes for the existing version rather than upgrading to a new version. This is done so that enabling security updates on your server will not cause software to become functionally different possibly breaking your services. Instead the security fix is backported and a newer release of the existing version is made available via the security update repository.

    Ubuntu is very good about releasing upstream security updates quickly and in most cases a fix for any new security issue (especially in popular packages like PHP) is released via the security repository within a day.


Ubuntu backports security fixes so they don’t have to change versions and risk breaking compatibility with existing applications. If you’re run apt-get update && apt-get upgrade, your installed PHP package is up to date. (Note that there’s two “&"s in that command right next to each other. It looks like you have one missing in your original question.)

If you’re instead looking to use a different version of PHP for the features in that version (for example, you want to use PHP 5.6 or 7.0), you can use ServerPilot to manage your server. ServerPilot makes available multiple versions of PHP at the same time (currently 5.4, 5.5, 5.6, and 7.0) so it’s easy to change PHP versions for your sites.

For example, this is how you change a site’s PHP version in ServerPilot:

Thanks for the comments. They had information I didn’t know about.

As for the double-&, I have usually ran those commands separately (first update, then upgrade) to see results clearly.

I’ll look into ServerPilot. Currently I’m ok with the current features of PHP :)

Hi, I think I would consider going for PHP7 for performance issues.
However you must know that some code is deprecated…

What I think you can do is create a dynamic IP in front of your server, then I think you can copy your server and upgrade a new instance. It would mean double pay for a motth or less I guess, but then you could just ponit the IP at your new server when you have tested your code on PHP7…


Current server: IP X
New server: IP Y
Current domain: DOMAIN Z

Then dynamic ip -> IP X
When that is done, you point your domain:
Domain Z > dynamic ip

And then you can run two VPS , you then upgrade your copy VPS and upgrade etc..
When it’s complete you just change the dynamic IP to point to your new server instance IP (IP Y).

I’m about 99% sure you can do it like this :-) Hope it was understandable....

  • Thanks for the suggestion! I cannot totally understand what you mean by dynamic IP. I could probably duplicate my current droplet and update PHP to the duplicate and test if it works. But after that I would need to duplicate the droplet again ja update PHP.

    • Hi, there is a guide here:

      But you wouldnt really make a load balancer, you put your floating ip so it points to your droplet. Then you change your domains A name to point to the floating IP.

      When you get nslookup on your domain to get the floating IP, you have an easy way to switch servers. So if you then have ready a new server with php7, you can switch in a second :-)

      If downtime is OK you can of course install PHP7 and PHP7-FM.
      The thing is that inside your webserver you change what PHP you are running.

      In NGINX I guess you could actually try this on the same server, by doing so:
      1: install PHP7 + PHP7FM
      2: set up a subdomain
      3: set up the subdomain in your nginx/sites-enabled/default
      4) in the subdomain you set it to run PHP7 like this guide shows:

      If you do that, you can try php7 in your subdomain while keeping PHP5.X in your main domain. If it works, you just copy that PHP7 code into your main domain in the ../default

      PS. remember copy of the file first :-)

      VERY important tip:
      If you are running wordpress on php 5.x, enable error logging and update to latest version. Fix all errors before migrating to PHP7, as some functions are deprecated. Old plugins might give you hassle!

      by Brennen Bearnes
      PHP 7.0 was released on December 3, 2015. It promises substantial speed improvements over previous versions of the language, along with new features like scalar type hinting. This guide explains how to quickly upgrade a PHP 5.x installation on an Ubuntu 14.04 system with Apache or Nginx, using community-provided packages.
      • Hi, thanks again! :)

        • Hi, no trouble.
          I have some other tips:
          Enable file open cache in nginx, enable gzip for different mime types :-)

          Also when you have done that, you can try to play with redis! Your VPS will fly, I’m quite amazed at what the 5$ VPS from DO can handle. If you do play with redis on DO, use socks if possible.

          I did a benchmark on my DO VPS with TCP vs Socks:

          I use redis for cache for both WP (as in the DO guide with the script they have), but I also use redis as a cache for my own gateway php-script that will handle API-data from third parties.

          The genious thing is that you can set the TTL for redis keys, so if you want to get data from several sources and want it to live let’s say 10 minutes, you just set it.. And then your APP can talk to one interface and it will recieve gzipped content which often is about 1/10th of what a regular XML or JSON was :-) This means quicker downloads, less domain lookup times etc.

          • Wow, good tips! :) I’m currently using Apache, so do you recommend changing to nginx or something else? I host several websites in my VPS.

        • Hi, Apache is fine, but Nginx is faster.
          You can also run Nginx in front of Apache as a reverse proxy.

          But also keep in mind if you want to learn Nginx or not :-) I didnt find it all that difficult and there are many guides on this site.

          I’m not 100% sure what I will recommend you, the thing is that for apache you can easilly use mod_pagespeed ( ), but on gninx you have to compile both ngx-pagespeed and nginx… So this means when upgrading, you have to do it again :-P

          If you put mod-pagespeed on apache you can get a lot of things “for free” performance wise and score a good score on google pagespeed insights.

          It will be easier to upgrade with apache.. I use nginx 1.9.10 and PHP7.0FPM. But I would also consider PHP7.0 FPM with Apache and maybe NGINX as reverse proxy in front.

          You can also add the redis script for super fast cache for wordpress.. Also if you run many WP sites, maybe you should consider a wp multisite install.