Upgrade from php v5.5.9 to v5.6.3

Posted under » PHP » Ubuntu on 30 Apr 2018

If your PHP version is no longer supported and have vulnerabilities it is time to upgrade. Since you can't upgrade, you have to add a new repository (while on sudo). I admit I find installing php from source is too tough for me. You can upgrade your ubuntu version which is risky because many things will not work anymore.

If you want to do this, do a comprehensive backup before starting anything.

add-apt-repository ppa:ondrej/php

If you get "command not found" error, install this first

apt-get install software-properties-common

In case you've not sure if the repo is already added... go this directory to see.

/etc/apt/sources.list.d/

You may wish to clean or get rid of your old php 5.5. apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

After which SUDO update and upgrade.

Ok the moment of truth. Install the new version of PHP.

apt-get install php5.6

Unfortunately, you will have to install again most of your usual stuff since it doesn't install it for you.

apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-gd

Stop and restart Apache and when you check for the new version,

php -v
PHP 5.6.36-1+ubuntu14.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

My experience is that some old codes will not work anymore.
 

web security linux ubuntu GIT svn Raspberry apache mysql php drupal cake symfony javascript Ajax css