CentOS 6.7 multiple PHP versions OVH Release 3

If you have an OVH Server with CentOS Release 3, you could want to use in some website a new PHP version than PHP 5.3.3 which is included on this Linux distribution. Here you can see how to install PHP 5.6 working together with PHP 5.3.3.

First of all, you must add the yum repository. We recommend SCLs (Software Collections) because allow you to run the default version while also allowing a newer version of php to be installed alongside the default php for use creating and running software with newer requirements. Furthermore, the source code is rebuilt by the CentOS Project, so you can be sure that the packages won’t have their own mailing lists, IRC channels, issue trackers, etc.
We could see how to install on the below references, but we will resume it on this post:

PHP 5.6 Installation

Install SCLs and Remi repositories

Install the collection packages for PHP 5.6

Remi collections packages use “more” prefix to avoid confusion with Red Hat packages. You can see which packages are available with this command

At this stage, you have the default PHP version working and PHP 5.6 version installed under ‘/opt/rh/rh-php56/’ directory and the configuration files under ‘/etc/opt/rh/rh-php56’ directory.

Site configuration

Since CentOS 6.7 OVH Release 3 makes use of suphp and fastcgi in the default configuration, we just have to set a couple of things to make our website run with the new PHP version.

In ‘/etc/suphp.conf’ file we add the handler for our php 5.6 php-cgi binary.

Now we configure this handler in our apache configuration of the domain which work with PHP 5.6 version. In the file ‘/etc/httpd/vhost/YOUR_DOMAIN_FILE.conf’ we change current PHP handler to the new created in ‘/etc/suphp.conf’ file.

Note: If you are using HTTP and HTTPS, you should set up this handler in both of configuration files.

Restart apache server

We restart the apache and your website will run the new PHP 5.6

We hope that this article was helpful for you, please let us know if do you have some question.

Leave a Reply