I need to install the following extensions with PHP 5.6 and Ubuntu 16.04, but ubuntu only installs extensions for PHP 7.

Trying to install these extensions produces the following error: Installing PHP 5.6 on Xenial (16.04)

I've got to use the extensions


and the gd library.

Best Answer

Ok finding in a lot of blogs and aswer, the obviously answer is add suffix in php, then for install php5.6 or before add this.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php7.0   # for PHP 7.0
sudo apt-get install php5.6   # for PHP 5.6
sudo apt-get install php5.5   # for PHP 5.5

later of this you need install extension with the following commands

if you install php 5.6 you need add 5.6 to php, for example

sudo apt-get install php5.6-gd php5.6-mysql php5.6-dom php5.6-cli php5.6-json php5.6-common php5.6-mbstring php5.6-opcache php5.6-readline

etc . or otherwise if you make php-gd you install gd for php7, and thanks to @elder-geek for add links