0

I have PHP 7.0 on my VPS with CentOS 6.10 and there is an application that needs PHP 7.1 and above. Also, there's a separate application that uses a php function that is deprecated in PHP 7.1, so I need both PHP 7.0 and 7.1

I have the remi-php70 and remi-php71 repositories, but when I do the yum --enablerepo=remi-php71 install php71 it shows No package php71 available.

I also tried installing the centos-release-scl package, but it again says No package centos-release-scl available.

I have a different VPS with CentOS 6.9 and both packages are available on it.

I don't know what's different in CentOS 6.10. Could use some help.

UPDATE: I realized the VPS is running 32-bit of CentOS 6 and the other VPS was running 64-bit. No wonder, it couldn't find the packages. So, any idea of running multiple PHP versions when centos-release-scl is not available in 32-bit CentOS.

NetworkNewbie
  • 135
  • 3
  • 9
  • 1
    You blow away the VPS and install 64-bit CentOS. There is absolutely no excuse for running a 32-bit server anymore, except possibly for extremely low memory (less than 128MB). – Michael Hampton Sep 02 '18 at 20:46

2 Answers2

3

I recommend you read PHP Configuration Tips which explain how to switch to FPM and use multiple PHP versions using Software Collections, designed for parallel installation.

Official RHSCL / Centos-scl repository provides rh-php70 and rh-php71 collections.

Remi repository provides some newer versions (php56, php70, php71, php72, php73) and is also use as upstream for RHSCL.

See the Wizard instructions for installation.

P.S.: newer official collections (such as rh-php71) are now only available for CentOS 7.

Remi Collet
  • 2,111
  • 1
  • 12
  • 12
0

Make sure that the repo is actually enabled first:

vim /etc/yum.repos.d/remi-php71.repo

Be sure that the enabled line says:

enabled=1

Do the same for

/etc/yum.repos.d/remi-php70.repo

Afterwards,

yum list available | egrep 'php71|php70'

Will give you all of the php71 and php70 packages which are available.

You can then proceed with:

yum install php70 php70-php php71 php71-php

Update

You can load different versions of php if you install the packages from the scl repo which begin with rh-php70, rh-php71, and so and and so forth.

Nasir Riley
  • 2,137
  • 9
  • 10
  • It will not work. How do you suppose to load 2 different version of php at the same time? You have to use mod_fcgid or php-fpm – ALex_hha Aug 26 '18 at 15:03
  • @ALex_hha Yes, it will work and yes, it does work. His question is that he isn't able to install `php71`. My answer gives the way to do that. He can have as many different versions of `php` as he wants. Which one he decides to load is up to him. He can run one version of `apache` with one version of `php` and then run another inside of a `docker` container with a different version of `php`. He can also build another from source and load a different version of `php`. He can also run a VM with `apache` and a different `php`. If he needs help with that then he'll have to submit another question. – Nasir Riley Aug 26 '18 at 16:29
  • Hmm, it seems you were right. I just remember that previously it was not possible to install multiple version of php from the same repo, my bad. – ALex_hha Aug 27 '18 at 09:12
  • You can run a SINGLE version of **mod_php**, but you can run multiple PHP versions simultaneously, using FPM, see link in my above answer. – Remi Collet Aug 27 '18 at 12:19