Help to change default php cli version in virtualmin

OS: Debian 10 | Webmin: 1.984 | Virtualmin: 6.17-3

I have 2 versions of php installed, 8.0 and 8.1, and in php cli I have 8.1 set

I want to set version 8.0 and although I follow what the official documentation says, I do not get the expected result

The documentation says: You can configure which one is the default PHP version used on new Virtual Servers. The default is to use the newest available. You can change that default in System Settings → Server Templates → Default → PHP Options, and on that screen you can set the default PHP version to use in the field Default PHP version.

I do it as you can see in the first image:

Though it shouldn’t be necessary, but just in case, I will also set 8.0 in Server Configuration → PHP Options always according to the documentation when it says that You can configure the PHP version being used for a specific Virtual Server by selecting Server Configuration → PHP Options

I do this as you can see in the second image:

The final result, after not restarting and after restarting (by trying all the options) is that I am still in 8.1 as you can see in the third image:

Any ideas? I am doing something wrong? Has the official documentation forgotten any steps? Thanks

virtualmin default php is for cgi, and website should run with php8.0 as you set it up.
cli has nothing to do with that, it’s only for console/manual execution of php scripts… if you want to run a script with php8.0 use eg. :
$ php8.0 -v

Thanks for your contribution

I have explained it this way because I wanted to be as clear as possible. The reality is when I call a cronjob, the version of php that is executed is php8.1, not the one you use for that virtual host. So are we saying that this cannot be changed for the server? Does that mean that if I want to launch a cronjob in php 8.0 I must indicate it in the call itself and that will be the only possible alternative?

as far as i know, yes.
system default is newest php, if you want to change it globally, either remove php8.1 alltogether, or change the default by changing alternatives. see :
$ update-alternatives --query php
but if you change it globally, then any php ... call would be php8.0… so it depends on what you want to do… if it’s just one cronjob, well, i’d probably change that to php8.0 command.

1 Like

Well, unless someone says otherwise, it works for me. Thanks

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.