I am new to using Linux and I broke some php settings while tampering.
If I execute a php script containing: phpinfo(); it shows the php versions as 5.
phpinfo();
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!!