Centos7下Yum更新安装PHP5.5、5.6、7.0

Yum源默认的版本太低了,手动安装有一些麻烦,想采用Yum更新安装的可以使用下面的方案:

1.检查当前安装的PHP包
yum list installed | grep php

如果有安装的PHP包,先删除他们
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

2.更换rpm源

  • Centos 5.X:
    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 <上面搜索到的包>

3.运行yum install

  • 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 php55w-xml.x86_64
  • php5.6
    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 php56w-xml.x86_64
  • php7.0
    yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-xml.x86_64

4.安装PHP-FPM

  • php5.5
    yum install php55w-fpm
  • php5.6
    yum install php56w-fpm
  • php7.0
    yum install php70w-fpm

systemctl enable php-fpm.service # 开机自启动

PHP在线安装升级完成!


» 本文链接:https://blog.apires.cn/archives/784.html
» 转载请注明来源:Java地带  » 《Centos7下Yum更新安装PHP5.5、5.6、7.0》

» 本文章为Java地带整理创作,欢迎转载!转载请注明本文地址,谢谢!
» 部分内容收集整理自网络,如有侵权请联系我删除!

» 订阅本站:https://blog.apires.cn/feed/

标签: CentOS, PHP, CentOS7

添加新评论