1.检查当前安装的PHP包php
yum list installed | grep php
若是有安装的PHP包,先删除他们mysql
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
追加CentOS 6.5的epel及remi源。linux
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
如下是CentOS 7.0的源。web
# yum install epel-release # rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。redis
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
yum源配置好了,下一步就安装PHP5.6。sql
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-redis
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
在这里安装的版本是PHP5.6.13。缓存
从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。php-fpm
其余源:学习
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm CentOs 6.x rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOs 7.X rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
若是想删除上面安装的包,从新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包便可spa
3.运行yum install
yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
注:若是想升级到5.6把上面的55w换成56w就能够了。
4.安装PHP FPM