如果有安装的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

yum 安装我们需要的软件

1.安装epel软件源
1.rpm -qa | grep epel-release  确认当前机器是否用 epel-release (这个源有非常丰富的软件包)
2.sudo yum install epel-release 
3.yum --disablerepo=epel -y update ca-certificates
2.php7.1 + php-fpm + nginx + apache 统统都可以用 yum 安装啦
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum search php71w 看下为php7.1版本提供了哪些包
常用包说明:
mod_php71w.x86_64 : PHP module for the Apache HTTP Server
php71w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php71w-cli.x86_64 : Command-line interface for PHP
php71w-common.x86_64 : Common files for PHP
php71w-devel.x86_64 : Files needed for building PHP extensions
php71w-fpm.x86_64 : PHP FastCGI Process Manager
php71w-gd.x86_64 : A module for PHP applications for using the gd graphics library
php71w-ldap.x86_64 : A module for PHP applications that use LDAP
php71w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php71w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php71w-pdo.x86_64 : A database access abstraction module for PHP applications
php71w-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php71w-opcache.x86_64 : An opcode cache Zend extension
php71w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php71w-xml.x86_64 : A module for PHP applications which use XML
3.安装
yum install mod_php71w.x86_64 php71w-fpm.x86_64 php71w-devel.x86_64 php71w-bcmath.x86_64 php71w-cli.x86_64 php71w-common.x86_64 php71w-gd.x86_64 php71w-ldap.x86_64 php71w-mbstring.x86_64 php71w-mcrypt.x86_64 php71w-mysqlnd.x86_64 php71w-pdo.x86_64 php71w-pecl-redis.x86_64 php71w-opcache.x86_64 php71w-soap.x86_64 php71w-xml.x86_64 -y

如果选择用 nginx 那么 mod_php71w.x86_64 就可以不装了,这个包会自动装 apache.