Install php extensions in ubuntu 16.04
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