Enable php 5.6 on Ubuntu 18.04 / Plesk 17.8

Enable php 5.6 on Ubuntu 18.04 / Plesk 17.8

Ubuntu 14.04 reaches end of live at the end of April 2019.  So OS upgrades will be at the top of a lot of sysadmin TODO lists right now.  While Ubuntu 16.04 will be supported till April 2021 most will be looking to jump to Ubuntu 18.04 which be now be supported for TEN YEARS rather than the usual five.

As any of our customers will know Plesk has always provided 1 click PHP selection on a per domain basis.  This is a powerful tool for anyone rolling out different applications or testing upgrades with newer version of PHP. However, Ubuntu 18 supports only those versions of PHP that support OpenSSL 1.1, and that are PHP 7.x and newer. Therefore, if you require php 5.6 then you will need to take additional steps and manually install PHP 5.6 and add this as an additional handler in Plesk.


Obviously, in an ideal world EVERYONE would move to PHP 7.1 (php 7.0 is already end of life).  For Magento customers this is a win win situation. PHP 7x is significantly quicker than php 5.6 and more secure.  Magento have released patches that enabled M1 sites to run on php 7.1.  However, extension providers have shown little willingness to follow suite and this is where upgrade wagon hits problems.  Most clients are weighing up the costs of fixing this against shiny new Magento 2 sites.  So realistically php 5.6 will be needed for a some time to come. 

Fortunately, thanks to  Ondřej Surý for maintaining a PPA of most the popular PHP versions and because of Plesk's flexibility, it is relatively straight forward to add this support.

The following presumes you have 18.04 and Plesk 17.8 install already.

sudo add-apt-repository ppa:ondrej/php

sudo apt-get install php5.6

Most php application will require additional modules eg

sudo apt-get install php5.6-igbinary php5.6-mbstring php5.6-mcrypt php5.6-soap php5.6-redis php5.6-intl php5.6-mcrypt php5.6-mysqli php5.6-xml

As fpm is the most efficient way to run php we will need to install this also.

sudo apt-get install php5.6-fpm

The CGI is optional

sudo apt-get install php5.6-cgi

If you wish to set a specific version of php as the default CLI you can run 


sudo update-alternatives --config php

Finally we need to tell Plesk about this.

/usr/local/psa/bin/php_handler --add -displayname fpm-56 -path /usr/bin/php-cgi5.6 -phpini /etc/php/5.6/fpm/php.ini -type fpm -clipath /usr/bin/php5.6 -poold /etc/php/5.6/fpm/pool.d -service php5.6-fpm

If you now reload your Plesk php settings you will see the new handler in place. 

© 2016 Dx3webs Ltd. All Rights Reserved. | Company No. 08221801 | VAT No GB142 6020 55 | Terms & Conditions | Privacy Policy