Upgrading to php 5.5 from fresh install of Webmin/Virtualmin on CentOS 6.7 (step by step)

I’m setting up a VPS on DO droplet and spent the day yesterday getting php upgraded to 5.5. After some trial and error, this seems to be the steps to achieve this without wasting lot of time. It’s great that VM supports multiple version of PHP. There may be easier steps or shortcuts to the steps I’ve documented, but this seems to have worked for me. I’ll update it if I find anything that is broken. This could probably be taken to install 5.6 as well.

Site References:

1 - https://www.virtualmin.com/documentation/web/multiplephp
2 - http://stackoverflow.com/questions/17109818/install-php-mcrypt-on-centos-6
3 - https://www.virtualmin.com/node/33480
4 - https://webtatic.com/packages/php55/

From Webmin -> System ->Software Packages:
Search “php” and uninstall all packages. You’ll probably need to tick the Ignore Dependencies option.

All done from CLI:

// check to see if any old php modules exists, if so, remove
yum list installed | grep php
yum install scl-utils
rpm -Uvh https://www.softwarecollections.org/repos/rhscl/php54/epel-6-x86_64/noarch/rhscl-php54-epel-6-x86_64-1-2.noarch.rpm
yum install php54 php54-php-mysqlnd
rpm -Uvh https://www.softwarecollections.org/repos/rhscl/php55/epel-6-x86_64/noarch/rhscl-php55-epel-6-x86_64-1-2.noarch.rpm
yum install php55 php55-php-mysqlnd
rpm -Uvh https://www.softwarecollections.org/repos/rhscl/php56/epel-6-x86_64/noarch/rhscl-php56-epel-6-x86_64-1-2.noarch.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum update
yum install php-mcrypt*
yum install php54-php-mbstring
yum install php55-php-mbstring
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install php55w php55w-opcache
yum install yum-plugin-replace
yum replace php-common --replace-with=php55w-common
service httpd restart
yum install php55w-cli
yum install php55w php55w-opcache


I have installed 5.6 using the guide here.
Then I have tried to run the replace command.
yum replace php-common --replace-with=rh-php56-php-common

But when I try to run php -v it doesn’t get the command.
When trying to restart the httpd service it can’t locate the php process

What do I miss here?
I am running Centos 7.

To get the yum-replace-plugin installed I followed the following.
To use the IUS packages in CentOS 7:

  1. Install EPEL and IUS repositories:

yum --enablerepo=extras install epel-release

yum install https://centos7.iuscommunity.org/ius-release.rpm

  1. Install yum-plugin-replace and replace the php packages with php56u packages:

yum install yum-plugin-replace

yum replace --replace-with php56u php

  1. Restart any services which depend on php, such as httpd.
  • Tim

The Software Collections recipe works on my CentOs 7 server

From Virtualmin Recheck Configuration

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