26 June 2016

Updating from deprecated PHP 5.6 PPA

I'm running an Ubuntu 14.04.4 LTS server with Apache2 and phpMyAdmin running several Drupal 7 and 8 sites. I saw this message when getting updates and this is how I updated my system to the new PHP5.6 PPA:

Following the instructions from root I ran these commands:
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php5
apt-get dist-upgrade

This got PHP 7.0 on my system. To get PHP 5.6 I ran this:
apt-get install php5.6
I later found that I needed these extensions:
apt-get install php5.6-mysql
apt-get install php5.6-xml
apt-get install php5.6-gd

apt-get install php5.6-mbstring
apt-get install php5.6-mcrypt
apt-get install php5.6-zip

Apache was still running the old version, I disabled the php5 module, enabled php5.6 and restarted:
a2dismod php5
a2enmod php5.6
service apache2 restart

I had changed my PHP.INI file - which was in /etc/php5/apache2/php.ini
So I did similar changes in here /etc/php/5.6/apache2/php.ini
and restarted: service apache2 restart

The command line php was now running 7.0 so I changed it using this command:
update-alternatives --config php

Thanks to Ondřej Surý at https://launchpad.net/~ondrej/+archive/ubuntu/php

No comments: