Supported way to have PHP 5.6 and PHP 7.1 on CentOS 7

I just got a new server and upgraded the CentOS 7 base PHP 5.4 to 5.6 with REMI.
I see I can also install PHP 7.1 with “yum install php71” as a second PHP version.

Once I do this, I could add a handler for it in the Apache config, but only one PHP version could run through SUPHP correct?

Would I just make a new php71.conf in the conf.d directory (basically like the php.conf one IW comments out)?

Hi justec

I hope your having a lovely Christmas

As far as I know, you are correct

Have a happy new year

Many thanks


Hi Justec
Sorry, I did a little googling and it looks likely suphp will run more then 1 version of php, see link.
I have not tried it myself, and it is not for centos, but no reason to suppose it may not work, just read the bottom for suphp.c config
Many thanks


It works! I just tried this on my now old server (CentOS6) and it seems to work.

The only issue I see here is messing with the vhost file where it says specifically not to edit ( # php: default don’t edit between this and the “end php” comment below).

I think there is a way to change the vhost template so that this gets added into new sites and on updates to the vhost file through NodeWorx. Is this right?

  1. Install PHP 7.1 as secondary PHP (with Remi it’s just yum install php71)

  2. Update /etc/suphp.conf
    ;Handler for php-scripts
    x-httpd-php71=“php:/usr/bin/php71-cgi” <-- Add this line

  3. Update the Vhost file

php: default don’t edit between this and the “end php” comment below

<IfModule mod_suphp.c>
suPHP_Engine On
suPHP_UserGroup justechn justechn
AddHandler x-httpd-php .php
suPHP_AddHandler x-httpd-php .php
AddHandler x-httpd-php71 .php71 <-- add this line
suPHP_AddHandler x-httpd-php71 .php71 <-- add this line
suPHP_ConfigPath /home/siteworx/etc

<IfModule !mod_suphp.c>
<IfModule mod_php5.c>
php_admin_flag engine On
<IfModule mod_php4.c>
php_admin_flag engine On

end php

A follow up to this would making a specific site (or directory) just run as PHP 7.1 without having to rename all the files to filename.php71

Adding this to the .htaccess file does the trick
AddHandler x-httpd-php71 .php

You still need to have the “AddHandler x-httpd-php71 .php71” and “suPHP_AddHandler x-httpd-php71 .php71” in the main vhost file for the site, but this allows you to just make an entire SiteWorx account PHP 7.1 by default.

Hi justec

Many thanks, glad it appears to work and perhaps this is the way forward for multi php versions

I believe your correct in thinking of adjusting the vhost template but I suspect this maybe overwritten on major updates to Iw

Kudos to you

Many thanks and hope you have a happy new year


Here is the way to make new SiteWorx account vhost created with the php71.
Just edit “/chroot/home/interworx/etc/vhost-base.conf”

More Info:

Post from someone else on how to set this up using Litespeed web server

We did some basic testing of this configuration against 6.0.8, which is currently in the beta channel. InterWorx 6.0.8 adds per domain multiple php support. In my testing upgrading from 5.1.52 to 6.0.8 went smoothly, as did enabling multiple php and installing additional php versions.

InterWorx reports SiteWorx accounts as using the “System PHP” and not the version of php set in the vhost, but transitioning to our multiple php solution at that point is possible. If anyone using the multiple php solution in this post would like to test our solution we’d be happy to provide demo keys!

Hi Nathan

I hope your well

Sorry, have I missed a post to understand your post sorry

If it helps, I updated an old IW v5 server and had to run multiPHP.pex I think it was, to make it work normally as it could not find the different versions.

Worked lovely and man help was great

Many thanks


Since the new Iworx update isn’t out yet and I have a client asking me to get them on PHP 7, I was trying to implement my how to guide here on my CentOS 7 server and it isn’t working. Has something change in the Interworx setup that would prevent this or am I just missing something small?

It works now…

  1. The .htaccess trick doesn’t seem to be working, but just editing the vhost for that site to use the php71 as .php did the trick.

  2. The database wasn’t loading on the wordpress site. So then I did yum install php71-php-mysqlnd. That still didn’t fix it, but turns out at that point it was just a local php.ini file for that site that was breaking it.

Hi Justin

I hope your well and glad you resolved it

We use RC which includes the addition of multiPHP and all seems well

Many thanks


Yeah, I was trying to put off doing this until the new Iworx update, but a client needed it to test an issue on their website.

I just tried this on my now old server (CentOS6) and it seems to work.