Troubleshooting PHP Version Configuration Issues in Virtualmin

I’m facing an issue while trying to configure multiple PHP versions on my Virtualmin server. After installing multiple PHP versions and setting one as the default for my domains, I noticed that some of the domains are not picking up the correct PHP version and are still using the old version despite changing the configuration.

I’ve followed the installation process mentioned in the guide (check.virtualmin.com/docs/server-components/configuring-multiple-php-versions/) and confirmed that the PHP versions are installed correctly. However, when I go into Virtualmin and try to set the default PHP version for a specific domain, it doesn’t seem to take effect. Additionally, some of the domains continue using the wrong PHP version, and when I try to change it manually in their settings, it doesn’t update as expected.

I also tried to check the available PHP versions through the Virtualmin interface and verified that PHP 8.3 was available, but it’s still not applying properly across different domains. I’ve even tried to re-check the configuration and restart the server, but the problem persists.

Has anyone encountered this issue before? Could this be related to PHP-FPM settings, or is there a deeper configuration issue in Virtualmin I might be missing? Any help would be greatly appreciated!

Here’s the code I’ve used for installing the PHP versions and configuring the default one:

# For RHEL, Alma, Rocky, Oracle, CentOS, Fedora
dnf install php81-php-{cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}

# For Debian/Ubuntu
apt-get install php8.1-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}

# Command to install PHP extensions for all versions
for php in $(ls /etc/php); do 
  sudo apt-get install -y "php$php-"{curl,intl}; 
done

Despite these commands, the correct PHP version still doesn’t apply. What could I be missing?

Please post your system as requested, I’ve never had a issue changing PHP version on virtual server on rocky 9.

That’s not an “even” thing, that’s a thing you do every time you change any packages that Virtualmin relies on. So, every time you install a new PHP version, you should re-check configuration. That’s how Virtualmin finds out about changes like this.

It’s not clear to me what problem you have. What does “still not applying properly across different domains”? Do you not see the new version in the list of available PHP versions for a domain? Or when you change it does it not save? Or does it save, but it still runs under the old version?

The code that installs the packages for all the installed versions is for Ubuntu/Debian and not rocky, perhaps he is running this without adapting it to rocky i.e. DNF.

Do the docs need updating to indicate this?

I don’t know how the docs could be more clear. It specifically says which commands to use for which operating systems.

You really should include your OS and version. You seem to be trying to use commands intended for both kinds of operating system (RPM-based and deb-based), which is not a sensible thing to do.

You should have gotten errors from one of those commands. If you’re just completely ignoring the output of commands you run, you’re going to have a bad time.

2 Likes