Will not change PHP version

Ubuntu 20.04

Webmin version 1.960
Virtualmin version 6.13

One site didn’t like PHP 7.4 so I decided to also install 7.2
When I try to change PHP in Server Configuration / PHP Version I get:
Failed to save PHP versions : Apache virtual host was not found
Also the same error when I go back to 7.4.
When I check /home/domain/etc there is only folder php7.4 and a sym link php.ini -> php7.4/php.ini

Hope somebody can help me out.

I now realize that the error message is due to other reasons.

The problem now is that Virtualmin shows PHP 7.2 but phpinfo on the website still shows PHP 7.4.
Therefore, there will be an error for some plugins.

Hi,

Actually, no.

Unfortunately it’s a bug and we just fixed it. Expect it to be fixed with Virtualmin 6.14.

You can apply this change manually by editing /usr/share/webmin/virtual-server/php-lib.pl file and restarting Webmin with /etc/webmin/restart command.

Ok. Thanks. It worked.

But then I got another problem.
When I switch from PHP7.4 to PHP7.2 I can see the phpinfo.php is correct.
But now Wordpress can not run because it can not connect to MySql Database.
If I switch back to PHP7.4 it can. I tried to switch many times.
With PHP7.2 there is no connection to MySql.

In /etc/php/7.4/ there is:
/apache2
/cgi
/cli
/fpm
/mods-available

In /etc/php/7.2/ there is all but cgi

Is that the problem?

I now did install cgi also but still no database.
Php7.4 is ok. I get this text when I change to php7.2 or 5.6.

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

  • Are you sure you have the correct username and password?
  • Are you sure you have typed the correct hostname?
  • Are you sure the database server is running?

Nothing out of this is changed. phpinfo.php shows correkt information.
There is nothing about it in error log for that site.
Other WordPress sites on the same server are not affected and all use the same MySql database.
If I change one letter in DB_USER or DB_PASSWORD I get exactly the same error.