欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

centos6-7 yum安装php的方法(推荐)

程序员文章站 2024-01-30 10:26:34
1.检查当前安装的php包yum list installed | grep php如果有安装的php包,先删除他们yum remove php.x86_64 php-cli.x86_64 php-c...

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

总结

以上所述是小编给大家介绍的centos6-7 yum安装php的方法,希望对大家有所帮助!