change php version via command line

Hi,

In Virtualmin under ‘Server configuration’ -> ‘Php versions’ I have
Default HTML directory 7.0.27
empty row 5.6.36

How can I change this default 7.0.27 via command line? Of course in the interface there is no a problem but I want to do this in a script.

Kind regards

I’m not sure I fully understand what you want to achieve. But if you want to change PHP version for command line, AKA php-cli version you can use below instructions.

List all PHP versions available,
update-alternatives --list php

Then you can change the PHP version with following command,
update-alternatives --set php /usr/bin/php7.1

Source: Use Multiple PHP Versions With Virtualmin

Hello, I think I have same problem.
I have installed tree different PHP version two versions (5.4.10 and 7.0.27) already came preinstalled, 3rd that I have installed 7.2.10 using yum rh-php72-php with other components. The problem is when I use command line somehow it uses another version of PHP and not 7.2.10. I know that 7.2.10 works because using Magento web installer it allowed me to install newest 2.3 version.
By this post https://vpsfix.com/7091/multiple-php-versions-virtualmin-nginx/
with this command:
update-alternatives --set php /usr/bin/php7.2
it should fix the problem, but using command “update-alternatives –list” does not show any PHP version.
For now, only other option I have is to remove 5.4.10 and 7.0.27 versions and only keep 7.2.10

CentOS 7 64bit with Webmin/Wirtualmin/LAMP on VPS