What is the best way to install PHP 5.5.9 or higher on RHEL 7.x based Virtualmin system?

We are trying to prepare our RHEL 7.x based Virtualmin systems for hosting soon-to-be-released Drupal 8. And unfortunately it is a know fact (<-link) that PHP 5.4.16 is the standard version provided with with RHEL-7 while Drupal 8 requires PHP 5.5.9 or higher as noted on https://www.drupal.org/requirements.

In RHEL 7.0 Release Notes (<-link) they elaborate on so called "Red Hat Software Collections" and refer to Red Hat Software Collections Product Life Cycle (<-link), where the following table mentioning PHP versions and their life cycles is presented:

Collection Release Date Retirement Date RHSCL Version
PHP54 Sept 2013         Oct 2016                 RHSCL 1
PHP55 June 2014         Oct 2016                 RHSCL 1.1
PHP 5.6 April 2015 April 2018         RHSCL 2.0

So I wonder if Virtualmin is capable to use "Red Hat Software Collections"? If not then what is the best way to replace the officially supported PHP 5.4.16 with PHP 5.5.9?

Why not running multiple versions as instructed on https://www.virtualmin.com/documentation/web/multiplephp? Well, because on https://www.virtualmin.com/node/17857 Eric clearly states it is not possible:

The problem is because all the PHP packages have their binaries are in the same locations. When PHP4 was still in use, Virtualmin supported using PHP4 and PHP5 on the same server -- but that was because both PHP versions were designed to work side-by-side.

P.S. Markup here is terrible, 'cause not showing (underlining or coloring) the links, so I had to add (<-link)s.

Status: 
Closed (fixed)

Comments

Howdy -- the Forum post you linked to there is from 2011 -- back then, Software Collections didn't exist, and Virtualmin didn't support multiple PHP 5.x versions.

However, using the instructions you linked to, it is indeed now possible to use the PHP version in the Software Collections repositories, alongside the PHP version that comes with CentOS.

It is crazy, but on https://www.drupal.org/requirements/php#8 they recommend to use PHP 5.6.5 or even PHP 7:

Drupal 8 requires version PHP 5.5.9 or later, with the CURL extension. However it is recommended to use 5.6.5 or higher. PHP 5.6 is the latest minor release of PHP and therefore offers extra performance and security. Since 5.6.5 (and 5.5.21) PHP also provides built-in SQL injection protection for mysql databases. PHP 7 is your best bet once released, as it has much improved performance.

Hi Eric,

Thanks for prompt reply. Can you please elaborate how exactly we do that so that it is fully compatible with Virtualmin?

Do you know when Drupal is expected to release version 8?

At the moment, it looks like the latest PHP version available in the Software Collections repository for CentOS 7 is 5.5.6, which wouldn't meet the requirements you mentioned above.

I suspect they'll add newer PHP versions to their repository though.

Thanks for prompt reply. Can you please elaborate how exactly we do that so that it is fully compatible with Virtualmin?

Our recommended method for installing a second PHP version is contained in the documentation here:

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

If you have any questions on that, feel free to let us know!

Do you know when Drupal is expected to release version 8?

There is no certain date set, though per https://www.drupal.org/core/dev-cycle it will be really soon.

There are no more critical issues, and according to https://drupalreleasedate.com based on comparatively small number of major and normal issues left, it could happen as soon as October 4, 2015, three days from now.

So it is really high time for us to do something with our Virtualmin systems :(

Our recommended method for installing a second PHP version is contained in the documentation here: https://www.virtualmin.com/documentation/web/multiplephp If you have any questions on that, feel free to let us know!

Eric, thanks, but the initial request was about RHEL 7.x based Virtualmin systems and instructions on https://www.virtualmin.com/documentation/web/multiplephp are for RHEL 6.x based systems. There is no centos-release-SCL for RHEL 7.x.

This confirmed by running the yum --enablerepo=extras install centos-release-SCL command:

yum --enablerepo=extras install centos-release-SCL
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.pac-12.org
* extras: centos.mirror.ndchost.com
* updates: mirrors.easynews.com
No package centos-release-SCL available.
Error: Nothing to do

So it is still unclear how to get newer PHP version installed on RHEL 7.x based Virtualmin systems

I am afraid per http://www.johnwillis.com/2014/11/rhel7-how-to-enable-software-collectio... Software Collections are available only for the following RHEL subscriptions:

Red Hat Enterprise Linux Server, Premium
Red Hat Enterprise Linux Server, Standard
Red Hat Enterprise Linux Academic Server

But what about other free distros like CentOS, Scientific Linux which rely on RHEL? We have the whole fleet of servers built on Virtualmin and we need to make them work for Drupal 8.

We haven't done much testing with Software Collections and CentOS 7.

Reviewing the various documentation I see on there, it appears the method for setting that up is slightly different than in the older directions we have for CentOS 6.

It does appear that Software Collections should work with CentOS 7, but we don't have any instructions for setting that up at the moment.

If you're able to install PHP from the software collections repository, it should be detected by Virtualmin. That is, if you wish to try it on your own, it really should work.

However, we'll do some testing of all that, and will work on putting together instructions for making that work on CentOS 7. If you're able to hold off for a bit, we'll have instructions for setting that up.

Thanks for the link!

In my reading, I've realized that our method of setting up the SCL repository shown in the documentaion is an older one, they appear to prefer doing things a slightly different way now.

So I'll be overhauling the SCL documentation for CentOS 6, as the new way works for both that and CentOS 7.

Let me just say that we've been running the SCL collections on CentOS 7 just fine (primarily for the purpose of running Drupal 8). We're using 5.5 currently on CentOS 6 and 7 . I'm still having a couple of niggling issues with PHP 5.6 and frankly they've not been important enough for me to iron out with all the other stuff in the hopper. But it works fine with Virtualmin.

So I'll be overhauling the SCL documentation for CentOS 6, as the new way works for both that and CentOS 7.

Nice to hear that, Eric!

But it works fine with Virtualmin.

Cruiskeen, do you mind sharing how exactly you set it up? It would be helpful for Eric to make this possible for all Virtualmin users.

Thanks, guys!

We'll be releasing instructions for how to set that up soon.

However, you're also welcome to perform the installation yourself, using the instructions found on the SCL site.

The instructions for doing that with SCL are the same on a Virtualmin server as they are on a non-Virtualmin server.

Edit: Sorry, I meant to say "SCL", not "EPEL", I updated the text above.

Eric, can you give any ETA of "soon"?

Any update on this? Common guys, more and more people would like to give a try to Drupal 8 RC, which is already available on the main page of http://drupal.org

Sorry for the delay... this is still being worked on.

We ran into some snags for how this works that will need to be corrected in the next Virtualmin version.

Note that we don't have official support for unreleased software though.

You're welcome to try out software before it's released, but in those cases you may need to perform some manual steps.

We are planning to have instructions for this soon, but that'll need to coincide with a Virtualmin release to correct the problems we discovered.

Eric, I know that *min doesn't provide official support for unreleased software, however Drupal 8 release is so close and we have to provide our customers some kind of legitimate way of installing it. And we would like to stick with whatever solution your team will offer, because we use Virtualmin on all our servers. Otherwise we could hit lot's of incompatibility issues in the future.

I really hope *min will not fail us on this.

We've been running Drupal 8 for quite a while now -I realize Virtualmin does not really support it directly, but it's reasonably easy to install PHP 5.5 from the SCL repository, and that seems to work pretty well in Virtualmin.

We've been running Drupal 8 for quite a while now -I realize Virtualmin does not really support it directly, but it's reasonably easy to install PHP 5.5 from the SCL repository, and that seems to work pretty well in Virtualmin.

cruiskeen, thanks for your input, however as explained before it can be done in different ways and for compatibility purposes we would like to stick with whatever method will be offered by *min developers.

Besides, you seem to have been ignoring request to share your way in comment #16. If it was so easy they (*min developers) would roll it out earlier. So why don't you start contributing instead of just bragging?

I think he's just offering that using the SCL website we recommended, it's possible to use the instructions on there in order to get newer PHP versions working on CentOS 7. Our instructions are based on that.

It takes time for us to test and write cross-platform documentation on it for Virtualmin users, which is why we didn't release that earlier.

We ran into some issues with newer PHP versions in that repository, though after realizing it wasn't all of them, it no longer looks like this will require a new Virtualmin version as I initially indicated.

Earlier today I updated the Virtualmin "Multiple PHP" docs to include how to install PHP 5.5.x on CentOS 7.

Yes, that's exactly what I'm saying. Just install the SCL repo, install PHP 5.5 from it, and install whatever PHP/pecl modules you need in your practice. This works fine in CentOS 6 or 7, but you'll undoubtedly want 7 if you're going to be running the database on the same server since you'll then have a version of MariaDB recent enough for Drupal 8 support.

It's really no different than installing PHP 5.4 on CentOS 6 -

PHP 5.6 is a little more messy because it's not built exactly the same as the others, which is I think the issue referred to about Virtualmin compatibility.

I wasn't bragging - just saying that if you follow the instructions for installing PHP 5.5 out of SCL it works. I do have my own company to run - I put in some help here when I get a chance, but it's really not my "job" to do this. You might if it is really important to you put in an actual support request, assuming you're using VIrtualmin Pro --- 5 And it really will be a while before Drupal 8 comes out of RC status.

Thanks for your input cruiskeen! He is indeed a Virtualmin Pro user... his request was for instructions on how to get PHP 5.5 working on CentOS 7.

We did indeed get those created, those are available here now:

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

That works for PHP 5.4 and PHP 5.5, but not 5.6... they changed the path for some odd reason, and that's preventing Virtualmin from detecting it.

So PHP 5.6 from the SCL repository will work, but only after the next Virtualmin version is released.

Eric, I've finally got it working. Thank you very much for updating the documentation!

I've installed PHP 5.5 which satisfies Drupal 8 requirements. However, sometimes we need to work with Drupal 8 on CLI and unfortunately even after switching the working directory to document root of installed Drupal 8 the 'php -v' command still shows PHP 5.4.16. I wonder is it possible to run two PHP on the same system and to be able to use both PHP CLI versions?

BTW, the 'php55-php-cli' has already been installed:

root@centos7.host.tld/home/should/www#
yum install php55-php-cli
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.chpc.utah.edu
* extras: mirror.lax.hugeserver.com
* updates: repos.lax.quadranet.com
Package php55-php-cli-5.5.21-4.el7.centos.x86_64 already installed and latest version
Nothing to do
root@centos7.host.tld:/home/should/www#

I just can't figure out how to load it when working in Drupal 8's directories in CLI.

The "php" command, without a path, will indeed run the PHP version included with CentOS.

To execute one of the other non-standard PHP versions that come with the SCL repository, you would need to call it with the full path.

You can do that using a command such as this:

/opt/rh/php55/root/usr/bin/php -v

The problem is that I am using Drush in Virtualmin's post creation script to install Drupal. It works for Drupal 6 ann 7 with no issues, however installing Drupal 8 is failing because Virtualmin executes its post creation script in PHP 5.4.16.

Using something like:

/opt/rh/php55/root/usr/bin/php drush si standard --account-pass=DZ8w51mF5hGwpoU --db-url=mysql://gret@localhost/gret_gret;

also doesn't work.

I wonder is it possible to make Virtualmin's post creation script to use PHP 5.5's environment at all? Or alternatively this issue could be addressed if Drush could be run in PHP 5.5.

You mentioned that running drush using the PHP 5.5 command didn't work.

What happened when you tried that? What error(s) did you receive?

Drush executes a subshell --- you either need to put the correct php on your path (as I mentioned above using scl command, or by explicitly setting your path to use the correct php) or by using the --php argument to drush. One way or another drush needs to know where to find the right php version,. For more details see https://www.drupal.org/node/662926

Ok, found the solution - running the 'source /opt/rh/php55/enable' command loads necessary environment.

As to the drupal install failing -- you need to set the PHP version in VIrtualmin BEFORE you do the Drupal install - it works fine then.

As to the drupal install failing -- you need to set the PHP version in VIrtualmin BEFORE you do the Drupal install - it works fine then.

cruiskeen, your opinion is appreciated, but as stated above i am using drush not virtualmin's native drupal install script.

marking this as closed again.

Okay, glad to hear it's working now -- feel free to let us know if you have additional questions!