centos7 默认PHP5.4,版本太低,很多要求至少PHP5.5
1、查看已经安装的PHP组件
yum list installed| grep php
php.x86_64 5.4.16-46.el7 @base php-cli.x86_64 5.4.16-46.el7 @base php-common.x86_64 5.4.16-46.el7 @base
2、卸载原有PHP组件
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64
3、安装新源
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
4、安装PHP5.5
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
5、查看版本
php -v
PHP 5.5.38 (cli) (built: Jul 21 2016 12:25:20) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
6、升级后安装memcache
yum -y install memcached #安装memcached
chkconfig memcached on # 开机启动
service memcached start # 启动服务
netstat -tunlp | grep memcached # 查看memcached是否启动
yum install libmemcached # 安装libmemcached
// 如果php中 new Memcached() # 安装memcached
yum install php55w-pecl-memcached.x86_64 # 安装升级版本对应的memcached
// 如果php中 new Memcache() # 安装memcache
yum install php55w-pecl-memcache.x86_64 # 安装升级版本对应的memcache