Install Multiple PHP Versions and PHP 5.5 with Virtualmin on CentOS

PHP5.5

Beginning in Virtualmin 3.99, Virtualmin allow you install multiple version of PHP with Software Collections.

To install PHP 5.4 from the Software Collections repository, perform the following steps:

  1. Log into your server over SSH as root
  2. Setup the SCL repository with this command: yum install centos-release-SCL
  3. Install PHP 5.4 and scl-utils with this command: yum install php54 php54-php-cli php54-php-mysql php54-php-gd

To install PHP 5.5:

yum install https://www.softwarecollections.org/en/scls/rhscl/php55/epel-6-x86_64/download/rhscl-php55-epel-6-x86_64.noarch.rpm
yum install https://www.softwarecollections.org/en/scls/remi/php55more/epel-6-x86_64/download/remi-php55more-epel-6-x86_64.noarch.rpm

yum install scl-utils php55 php55-php-mysqlnd php55-php-pdo php55-php-mcrypt php55-php-gd php55-php-mbstring php55-php-xml php55-php-pear php55-php-soap php55-php-opcache

 

Configuring the second PHP Version in Virtualmin

Once you have completed the installation of a second PHP version, you can verify that Virtualmin sees it by logging into Virtualmin, and clicking System Settings -> Re-Check Config. You should see something like this:

The following PHP versions are available : 5.3.3 (/usr/bin/php-cgi), 5.4.16 (/opt/rh/php54/root/usr/bin/php-cgi)

You can configure which one is the default PHP version used on new Virtual Servers. The default is to use the newest available. You can change that default in System Settings -> Server Templates -> Default -> Apache Website, and on that screen you can set the default PHP version to use in the field Default PHP version.

Other posts