On your system, if you have installed both PHP 7.1 and PHP 5.6 version. PHP 7.1 is running as default PHP for Apache and CLI. For any requirement you need to use PHP 5.6. Then you don’t need to remove PHP 7.1. You can simply switch to PHP version 5.6 and set this as default for Apache and system command line.
Set PHP 5.6 as Default
Use the following set of commands to set PHP 5.6 as default version for Apache and command line.
$ sudo a2dismod php7.1 $ sudo a2enmod php5.6 $ sudo service apache2 restart
$ sudo update-alternatives --set php /usr/bin/php5.6