Can Webmin run all these PHP versions together

Hi all, I’m planning to move to a new server (most likely Hetzner) from one that was commissioned in 2016 and is using WHM/cPanel. I’d like to drop WHM/cPanel and use Webmin/Virtualmin instead. The server will be hosting small-scale websites with a typical LAMP stack. Most sites are on PHP 7.4, some are on 8.1, and a few are still on 5.6. Is it possible to run Webmin with all of these PHP versions together?

Yes.
www.virtualmin.com/documentation/web/multiplephp/

PHP 5.6 too? I can’t see where it says the actual versions.

You would have to check the correct repo according to the OS you install. If it is there, then yes, you can run it. But I think 5 was EOL since 2019?

www.php.net/eol.php

And:

If you must run PHP 5, I recommend you do it on an isolated system, and you do it with an OS that still provides maintained PHP 5 packages (that is only CentOS/RHEL 7 at this point). Normally, I strongly discourage running old distros, but if you must run an ancient PHP, that’s the only reasonably safe way to do it.

Thanks for the feedback everyone, much appreciated.

I can confirm the function of all PHP version (5,7,8). You can find the installation of versions on the Internet according to the system you use.

Thank you @febet . Which operating system are you using? Are you installing them one-by-one? Any tips to how you’ve gone about this would be appreciated.

Debian 11
install for example:
php 7.0:
add-apt-repository ppa:ondrej/php
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4f4ea0aae5267a6c
apt-get update
apt install php7.0 php7.0-dev php7.0-cli
apt install php7.0-gd php7.0-bcmath php7.0-cgi php7.0-common php7.0-fpm php7.0-json php7.0-ldap php7.0-mbstring php7.0-mcrypt php7.0-xml php7.0-zip php7.0-mysql php7.0-sqlite apt install libapache2-mod-php7.0

php5.6:
apt-get install php5.6 php5.6-dev php5.6-cli
apt-get install php5.6-gd php5.6-mysql php5.6-imap php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php5.6-soap php5.6-opcache libicu65 php5.6-common php5.6-json php5.6-readline php5.6-xml php5.6-cgi

etc… good luck
Everything on the Internet is on the right question

1 Like

or this is also a good source of information:

1 Like

stick to Virtualmin documentation,
https://www.virtualmin.com/documentation/web/multiplephp/

Thanks for all the input everyone.

The plan now is to experiment a bit with Webmin in general. Just for setting it up and to see how it all runs, not to run any production websites. What would be the minimum cheapest I could get away with from here: High Performance, High Frequency, Bare Metal, Affordable Cloud Computing - Vultr.com

I was thinking this should do the trick?
1 vCPU / 2 GB / 3.00 TB / 50 GB / $12.00 per mo / $0.018 per hr

I use them, great for experimenting. Best you use virtualmin if you setting up websites.

Looks like you’ve installed mod_php, which breaks all other execution modes (and is wildly inefficient and also dangerous). You should not do that (and don’t recommend others do that).

Installing, e.g., the php7.0 or php7.0-php package installs mod_php, if no other execution mode is already installed.

We provide documentation for installing other PHP versions here: Multiple PHP Versions – Virtualmin

Following our docs will not install mod_php, and thus will not break other execution modes or introduce security issues.

1 Like

Following that guide on vsys.host will install mod_php. You should not install mod_php. I’m begging y’all to stop installing mod_php.

Hello,
thanks for reminder.
I would not like to be wrong, but I do not think that your estimate is right, I can confirm that PHP mods work as they should.
(after the above installation)

This is incorrect! It will install mod_php! Never install php-7.0, php-7.3 or etc php packages.

You can install PHP 5.6 on Ubuntu 22.04 and/or Debian 12 (or 11) system, along side up to PHP 8.3. It is not recommended to install PHP 5.6 though, as Joe mentioned but if you have to, there is a way.

All you need to do though to install it, is to enable Ondrej repos, and then install the following packages (without installing mod_php), e.g.:

Ubuntu example:

LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update
apt-get install php5.6-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}
apt-get install php8.3-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}

Debian example:

apt-get -y install apt-transport-https lsb-release ca-certificates curl && curl -sSL -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/sury-debian-php-$(lsb_release -sc).list' && apt-get update
apt-get install php5.6-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}
apt-get install php8.3-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}

phpinfo() and Virtualmin confirm PHP Script Execution Mode “FPM” and “Mod_php” is not offered anywhere in the PHP configuration. Even checking Configuration does not mention “mod_php” anywhere.
thank you for your response

phpinfo() image is above

It will only install mod_php if no other execution mode is installed first, but since most users installed php7.0 or whatever, first, they don’t have other execution modes and mod_php is the first package in the list that satisfies. The dependency list looks like this:

Depends: libapache2-mod-php8.1 | php8.1-fpm | php8.1-cgi,
         php8.1-common, ${misc:Depends}

Or the original source: debian/control · debian/main/8.1 · Debian PHP Team / php · GitLab

So, if the user preinstalls php7.0-fpm or php7.0-cgi before installing php7.0, they will avert disaster.

Or, they can just follow our documentation, and not install that package and not worry about it.

1 Like

It doesn’t matter more about the installation of libapache2-mod-phpX.x?