bhaveshpp@bhaveshpp:~/Downloads$ sudo update-alternatives --set php /usr/bin/php
php php7.1 php7.4 php8.1
bhaveshpp@bhaveshpp:~/Downloads$ sudo update-alternatives --set php /usr/bin/php7.1
[sudo] password for bhaveshpp:
update-alternatives: using /usr/bin/php7.1 to provide /usr/bin/php (php) in manual mode
bhaveshpp@bhaveshpp:~/Downloads$ php -v
PHP 7.1.33-44+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Nov 19 2021 06:37:31) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33-44+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
bhaveshpp@bhaveshpp:~/Downloads$ sudo a2dismod php7.4
Module php7.4 disabled.
To activate the new configuration, you need to run:
systemctl restart apache2
bhaveshpp@bhaveshpp:~/Downloads$ sudo a2enmod php7.
php7.1 php7.4
bhaveshpp@bhaveshpp:~/Downloads$ sudo a2enmod php7.1
Considering dependency mpm_prefork for php7.1:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.1:
Enabling module php7.1.
To activate the new configuration, you need to run:
systemctl restart apache2
bhaveshpp@bhaveshpp:~/Downloads$ sudo systemctl restart apache2