change php version via command line

3 posts / 0 new
Last post
#1 Tue, 08/21/2018 - 10:20
krispol

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

Sun, 08/26/2018 - 09:39
Freddy63
Freddy63's picture

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

Thu, 01/03/2019 - 16:22
Haruyuki

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

Topic locked