PHP versions 5.6 and 7 on Debian 9 using Virtualmin

Hi there. I’ve installed Debian 9 minimal. I would like to setup and install Virtualmin 6.02 to be able to host sites running PHP v5.6 or v7.*. What is the best way to achieve this?

PHP7 is the minimum version on Debian 9, if you want to use PHP5.6 you’ll have to use add another package repository, you have details here on stackoverflow:

Also, you can install it, but i wouldn’t recommend it unless it’s absolutely necessary, I have tested it myself and, I had lot’s of strange behavior on Virtualmin/Webmin side, i.e wrong service being restarted, WordPress install failing and last but not least the uninstall process(aptitude purge) of php5.6 ins’t clean at all lots of remaining files have to be cleaned-up manually, probably a bad Debian packing.

hope that help

Thanks Matth. That is very useful. I wanted to stick with Debian because I’ve found it to be the most secure of the Linux packages (so far). The problem is I have an old website built with Wordpress which seems to break when I upgrade to php 7. Now, I have a decision to make: painstakingly edit each template file to be compatible with php 7 or switch from Debian to Ubuntu (or CentOS) and have flexible php versions.

Much respects again!


hi, well Ive been running server on debian 8 (jessie) and then accidently somehow Ive done distro upgrade, which pushed me debian 9 and during the update you know usual questions like y or n to be answered and it kept 5.xx and installed 7.xx… and it works… ive also done this on my home server (git and other intranet things) and it worked for me. basically what Ive done was installed debian 8, deploy virutalmin set everything up and once working all, i just done distro update and was able to keep both versions of php. no issues at all… you can try it your self within virtualbox or so, to see if for your self if that would work for you.


Cool. I will set up a local server (XAMPP) and try Matth’s suggestion then yours, then play around with them to see which performs better. Maybe that’s the commonsense way to do it but I was hoping to save time by just using what just works.

Thanks unborn,

it’s an interesting point, on my side I effectively started with a brand new Debian9 directly that’s probably why the behavior is different.

Thanks for the feedback

kind regards

I saw the same behavior a while back but I finally did a Debian 9 reinstall because I also saw some weird issues. If I recall correctly, bad things were happening when attempting to switch back and forth PHP 5 and 7 for a virtual host. I cannot test again as I got back to a fresh Debian 9 reinstall but that’s my experience.

Thanks for sharing Pierrot. Other advice I’ve been given is to switch to CentOS as it’s easier to switch PHP versions with thtat but I’d like to continue using Debian. Since reinstalling Debian 9 did you decide to stick only with PHP 7 and forget PHP 5?

Well I did stick only with PHP7 for that server, it’s not a major issue for me as I have other VPS’s with PHP5, so in case I need it, it’s just a matter of moving virtual hosts between server …

Okay. This has forced me to upgrade my website themes to be PHP 7 compatible. It’s been a good but painstaking journey.