2

Is php5.5 or php5.6 Available for CentOS 7?

Rahul
  • 13,309
  • 3
  • 43
  • 54

2 Answers2

1

Yes, it is available for CentOS 7. You just have to add "Webtatic EL yum repository" information corresponding to your CentOS/RHEL version to yum, like :

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

You can install php now, using :

yum install php56w php56w-opcache

Once completed, check php version by using command,

php -v

Update

as suggested by @jsbillings, Webtatic is listed as one of the 'known problem' repos on the CentOS Wiki. You can use IUS or SCL from CentOS Wiki instead of Webtatic.

Rahul
  • 13,309
  • 3
  • 43
  • 54
1

Red Hat has been working on a set of repositories called Software Collections (SCL). CentOS 7 includes a similar set of repositories which make it easier to install PHP 5.6, 7.1, and other things not available in the base repositories. I also recommend using EPEL and if you haven't changed defaults, it's as easy as:

yum install epel-release
yum install centos-release-scl

Now you should have access to all of the EPEL and SCL packages. To install PHP 7.1, you can simply

yum install rh-php71

It will add the packages to /opt/rh/rh-php71/root/*, but the php.ini configuration will reside in /etc/opt/rh/rh-php71/. To make the newly installed version of PHP the default PHP used from the command line, you can add to a file in /etc/profile.d/ :

printf '#!/bin/bash\nsource scl_source enable rh-php71\n' > /etc/profile.d/php71.sh ; chmod ugo+r /etc/profile.d/php71.sh

The process is similar for PHP 5.6. All of the other pre-built packages for PHP 7.1 can be found with:

yum search php71

More information about the EPEL and SCL repositories can be found here:

https://fedoraproject.org/wiki/EPEL

https://wiki.centos.org/AdditionalResources/Repositories/SCL

Liczyrzepa
  • 654
  • 5
  • 20