yum安装高版本PHP

1.删除原有的PHP包

yum list installed | grep 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.更新yum源

#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

3.安装依赖组件

rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  

4.安装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
#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
#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

5.安装php-fpm

yum install php55w-fpm 
yum install php56w-fpm 
yum install php70w-fpm

6.启动PHP

service php-fpm start

你可能感兴趣的:(yum安装高版本PHP)