centos6-7 yum安装php的方法

前端之家收集整理的这篇文章主要介绍了centos6-7 yum安装php的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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源

    先添加下阿里云的epel源

CentOS 6.X:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

 

CentOS 7.X:

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

如果想删除上面安装的包,重新安装

rpm -qa | grep webstatic

rpm -e  上面搜索到的包即可

 

3.运行yum install安装PHP

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-fpm PHP55w-devel

 

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-fpm PHP56w-devel

 

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-fpm PHP70w-devel

猜你在找的CentOS相关文章