How can I change php-cli version on Ubuntu 14.04?

Solution 1:

sudo update-alternatives --set php /usr/bin/php5.6

Please see: Source

Solution 2:

Here is more interactive way:

update-alternatives --config php

You'll see the list of all available versions and select one of them

Solution 3:

From PHP 7.1 => PHP 5.6

sudo update-alternatives --set php /usr/bin/php5.6

From PHP 5.6 => PHP 7.1

sudo update-alternatives --set php /usr/bin/php7.1

You can change the versions as you want.

You can check this tutorial

Regards!!