如果有安裝的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-certificates2.php7.1 + php-fpm + nginx + apache 統統都可以用 yum 安裝啦rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpmyum 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 XML3.安裝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.