How to install php56 on CentOS 6 x86_64
When I run yum install php php-devel php-mysql php-gd php-mbstring
, it will install php5.3.
yum list installed *php*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.tsukuba.wide.ad.jp
* epel: ftp.kddilabs.jp
* extras: ftp.tsukuba.wide.ad.jp
* updates: ftp.tsukuba.wide.ad.jp
Installed Packages
php.x86_64 5.3.3-46.el6_6 @updates
php-cli.x86_64 5.3.3-46.el6_6 @updates
php-common.x86_64 5.3.3-46.el6_6 @updates
php-devel.x86_64 5.3.3-46.el6_6 @updates
php-gd.x86_64 5.3.3-46.el6_6 @updates
php-mbstring.x86_64 5.3.3-46.el6_6 @updates
php-mysql.x86_64 5.3.3-46.el6_6 @updates
php-pdo.x86_64 5.3.3-46.el6_6 @updates
I just removed it yum remove php php-cli php-common php-devel php-gd php-mbstring php-mysql php-pdo
.
And I tried yum install php56w php56w-devel php56w-mysql php56w-gd php56w-mbstring
, but they are not available.
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: ftp.tsukuba.wide.ad.jp
* epel: ftp.kddilabs.jp
* extras: ftp.tsukuba.wide.ad.jp
* updates: ftp.tsukuba.wide.ad.jp
No package php56w available.
No package php56w-devel available.
No package php56w-mysql available.
No package php56w-gd available.
No package php56w-mbstring available.
Error: Nothing to do
How can I install php5.6 on CentOS 6?
Solution 1:
you would add repo into centos 6 by:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Next,
#yum clean all
#yum install php56w php56w-common
I hope help you!
Solution 2:
CentOS now offers Software Collections (SCL) as a repo installable from base:
yum install centos-release-scl
Once you've installed the SCL repo, you can install php 5.6:
yum install rh-php56
The CentOS documentation is slightly dated as is the Red Hat Documentation, but newer versions of php, PostgreSQL, MariaDB, MySQL, perl, ruby, etc. are available. It's also available on CentOS and RHEL 7 and is theoretically better integrated with the OS. The notes say that adding packages through SCL won't interfere with the system's utilities, such as yum.
To make the SCL version of PHP the default on the command line, run the following as root to add to the default profile:
printf '#!/bin/bash\nsource scl_source enable rh-php56\n' > /etc/profile.d/php56.sh
chmod ugo+r /etc/profile.d/php56.sh
This makes using pear to add PHP packages easier by setting $PATH
to include /opt/rh/rh-php56/root/...
Solution 3:
You can use REMI's repository
To enable it, follow these steps:
yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
- edit
/etc/yum.repos.d/remi.repo
and, under then[remi-php56]
tag, setenabled=1
yum install php
Please note that, doing that, you will update the system-wide php package to the 5.6 version. If you need, for some reason, install PHP 5.6 alongside the older, CentOS-distributed relase, you had to do a more complex side-by-side installation.