Is php5.5 or php5.6 Available for CentOS 7?
-
did my answer helped you to get php5.6 ? – Rahul Jun 16 '16 at 09:06
2 Answers
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.
- 13,309
- 3
- 43
- 54
-
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 04:39
-
1Webtatic is listed as one of the 'known problem' repos on the [CentOS Wiki](https://wiki.centos.org/AdditionalResources/Repositories). Better to suggest IUS or SCL. – jsbillings Jun 20 '16 at 00:27
-
-
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
- 654
- 5
- 20