How to add multiple PHP versions for Virtualmin if you’re using CentOS 7, PHP 7.1/PHP 7.2

CentOS has a software collections repository that allows you to install multiple PHP versions easily for Virtualmin. If think you’ll only ever just need a single PHP version, follow the reference at the end of this article. Please note as of 16 July 2019 the software collections repo does not have PHP 7.3 available.

yum install centos-release-scl
yum install rh-php72 rh-php72-php-mysqlnd

Substitute 72 with whichever version you require.

Now login to Virtualmin and do:

System Settings -> Re-Check Configuration

You should get a notice that a new version of PHP was installed and configured, for example:

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 7.0.27 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 7.1.8 (/opt/rh/rh-php71/root/usr/bin/php-cgi), 5.4 (mod_php)

Reference 1: https://www.virtualmin.com/documentation/web/multiplephp

Note:

The “rh-” format can be used to install any missing PHP package if you’ve followed the precise above instructions. For example, let’s say you want to install GD Graphics Library.

yum install  rh-php72-php-gd

will install the requisite library.

Reference 2:

I you just prefer to upgrade the PHP on your system, see this article instead: https://www.virtualmin.com/node/48280.
Please note this link’s method might clash with the side-to-side method as described in this article so use either this article or the link here and decide if you want one version only, or multiple versions.

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top