2

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

  • did my answer helped you to get php5.6 ? – Rahul Jun 16 '16 at 9:06
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.

| improve this answer | |
  • So I did what you suggested and it is still showing PHP 5.4.16 after I ran php -v – TwitchedOut Jun 16 '16 at 21:00
  • @TwitchedOut did you get any error while performing any steps which I mentioned ? – Rahul Jun 17 '16 at 4:39
  • 1
    Webtatic is listed as one of the 'known problem' repos on the CentOS Wiki. Better to suggest IUS or SCL. – jsbillings Jun 20 '16 at 0:27
  • @jsbillings ah, you are right. thanks for pointing out. – Rahul Jun 20 '16 at 5:37
  • @TwitchedOut see my updates and try again with new repos. – Rahul Jun 20 '16 at 5:44
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.