NOTE: these information were originally provided in a post I wrote on the Joomla forum

Many CentOS and Joomla users had a bad surprise lately: while Joomla 3.2 happily run on CentOS provided PHP packages (5.3.3), the 3.3 update strongly refuse to run on anything that PHP 5.3.10, citing security issues as the main reason. In my opinion, this is not a wise move - after all, the long-term distribution all apply custom patches and backports to their PHP version and, in this specific case, CentOS packages provide absolutely comparable security to the target 5.3.10 PHP version.

Anyway, we can do very little to change this situation: Joomla developer stated that the will not support older PHP version. So, how can we use Joomla on our beloved CentOS 6.x installations? While custom-patching Joomla's version-check functions can be tempting, this is not the best thing to do: any custom patching increase the risk of future problems, especially when updating your Joomla installation. On the other side, simply using a more up-to-date repository featuring PHP 5.4+ can not be practical: maybe you have other sites on hosted on your server, and (correctly) you don't want to introduce any possible problems for this sites, or you simply want to stick with default repositories.

Fortunately, the solution exists: say hello to "Software collections" or SCL in short.

But what are "Software collections" in CentOS/RedHat parlance? Simply put, they are a list of newer softwares - a collection - that can be side-loaded to your regular OS installation. The important bit is the side-loading part: installing a package included in the software collection will not change, upgrade or substitute any base package, but it will be installed in a special directory created under /opt. So, to use any SCL package you had not only to install it, but also enable it on a per-application (or per-shell) basis.

As the current SCL release for CentOS/RedHat 6 include PHP 5.4+ version, we can use it to run newer Joomla installation. However, this is not enough: we must also configure Apache to selectively use this PHP version for only our Joomla 3.x virtualhost. Unfortunately Apache version 2.2 (the one provided with CentOS 6) can not load different mod_php module version, so we must use the somewhat older CGI/FastCGI interface. This means that while the default, mod_php provided PHP version 5.3 will be the default PHP version, our selected virtualhosts can use other and newer PHP versions using the CGI interface.

Recapping, in order to run Joomla 3.3+ on CentOS 6.x, we must complete three steps:

  1. enable the SCL repo and install PHP 5.4
  2. configure a PHP wrapper script (which will selectively provide the new 5.4 PHP version)
  3. configure the virtualhost to run PHP files via the CGI method

In the next page, we will run through each step.