安装php7
正常来说,下面的代码,能够正常的yum安装php7
代码语言:javascript复制#centos7
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
yum install -y php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64
yum install -y php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
yum install php70w-fpm php70w-opcache
但是我在使用过程当中,安装新的php插件时,遇到
mysql_connect(): Headers and client library minor version mismatch. 警告
类似的问题,所以我手贱卸载php-common导致php安装的又回到了php5(因为期间修改过yum源),然而再使用上面那套命令不能更新php7的yum源,所以只能退到重来
代码语言:javascript复制#进入yum目录,清除repo,下载新的国内yum源
cd /etc/yum.repos.d
rm -rf *
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#或网易的都可
#清除并重新创建缓存
yum clean all
yum makecache
#.卸载epel-release
rpm -e remi-release
yum remove epel-release
清空epel目录
rm -rf /var/cache/yum/x86_64/7/epel/
然后重新使用上面代码安装php即可