Switch php versions on commandline ubuntu 16.04

Manual Switching From PHP 5.6 => PHP 7.1

$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart

Manual Switching From PHP 7.1 => PHP 5.6

$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart