报错背景:
1.安装Nginx
[root@web01 ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
[root@nginx ~]# yum install nginx -y
#1.移除旧版php
[root@nginx ~]# yum remove php-mysql-5.4 php php-fpm php-common
#2.安装扩展源
[root@nginx ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@nginx ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#3.安装php7.1版本
[root@nginx ~]# yum -y install php56w php56w-cli php56w-common php56w-devel \
php56w-embedded php56w-gd php56w-mcrypt php56w-mbstring php56w-pdo php56w-xml php56w-fpm \
php56w-mysqlnd php56w-opcache php56w-pecl-memcached php56w-pecl-redis php56w-pecl-mongodb php56w-pecl-memcache
#4.替换php-fpm运行的用户和组身份
[root@nginx ~]# sed -i '/^user/c user = nginx' /etc/php-fpm.d/www.conf
[root@nginx ~]# sed -i '/^group/c group = nginx' /etc/php-fpm.d/www.conf
[root@nginx ~]# systemctl start nginx php-fpm
[root@nginx ~]# systemctl enable nginx php-fpm
当时发现php71上没有memcache扩展,php56上有,所以
卸载php71:
yum -y remove php71w php71w-cli php71w-common php71w-devel \
php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm \
php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb
安装php56:
yum -y install php56w php56w-cli php56w-common php56w-devel \
php56w-embedded php56w-gd php56w-mcrypt php56w-mbstring php56w-pdo php56w-xml php56w-fpm \
php56w-mysqlnd php56w-opcache php56w-pecl-memcached php56w-pecl-redis php56w-pecl-mongodb php56w-pecl-memcache
如果没有需求用php-memcache扩展的话,可以选择安装php71.