# Interactive Way
sudo update-alternatives --config php
# From PHP 7.1 => PHP 5.6
#Apache
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
#command Line
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar
$ sudo update-alternatives --set php /usr/bin/php7.1
$ sudo update-alternatives --set phar /usr/bin/phar7.1
$ sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
On Mac using Home Brew, you can switch php versions easily:
brew unlink php@8.0
brew link php@7.1
Or follow the upgrade path to get your app to support the newer php version