yum安装php和php扩展

报错背景:

 

#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 php56-pecl-memcache
#4.替换php-fpm运行的用户和组身份
[root@web02 ~]# sed -i '/^user/c user = nginx' /etc/php-fpm.d/www.conf
[root@web02 ~]# sed -i '/^group/c group = nginx' /etc/php-fpm.d/www.conf

 

发现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 php56-pecl-memcache

 

如果没有需求用php-memcache扩展的话,可以选择安装php71.

posted @ 2018-12-17 16:24  小菜鸟111  阅读(682)  评论(0编辑  收藏  举报