更换yum源码

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

安装php

yum install php72w

安装php扩展根据自己需求来

php72w-cli
php72w-common
php72w-devel
php72w-embedded
php72w-fpm 
php72w-gd
php72w-mbstring
php72w-mysqlnd
php72w-opcache
php72w-pdo
php72w-xml
php72w
php72w-bcmath
php72w-dba
php72w-enchant 
php72w-imap 
php72w-interbase
php72w-intl 
php72w-ldap  
php72w-mcrypt 
php72w-odbc 
php72w-pdo_dblib

查看安装版本

[root@php ~]# php -v
PHP 7.2.7 (cli) (built: Jul  1 2018 08:22:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

配置文件所在地址

php.ini             /etc/php.ini
php加载ini文件       /etc/php.d/*.ini
php-fpm.conf        /etc/php-fpm.conf    
php-fpm.pid         /var/run/php-fpm/php-fpm.pid
php-fpm启动          php-fpm