How to run multiple PHP versions

Hi all

Our web company runs our entire hosting infrastructure on Clear Linux and we absolutely love it. Great work.

However, the need has arisen to install an older version of PHP on Clear Linux (7.2) alongside the current 7.3. We don’t want to disrupt 7.3 from being the default but want 7.2 accessible for only one NGINX site on a server hosting around 100 sites.

What’s the best way to achieve this and deploy 7.2 on a live production server, preferably without downtime?

1 Like

I think the quickest way to do this would be to build php 7.2 and install it into /usr/local. Looking at the current php build, it has a bunch of generic php paths that aren’t versioned so that might take some time for us to provide.

Stupidly simple solution:

  1. uninstall php-basic bundle entirely
  2. grab the old RPM’s and use the rpm2cpio method to toss this back on the system.

This would still be potentially breaking if libraries change, so utlimately compiling it and installing into /usr/local would be better, but if you’re in a pinch, the above method could get you back up and running in just a few minutes until you can figure out the compilation.