这里推荐使用Webtatic yum源
其实看官网就可以解决问题
https://webtatic.com/
为方便查看摘录一部分:
###CentOS/RHEL 7.x:###
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
###CentOS/RHEL 6.x:###
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Now you can install PHP 7.1’s mod_php SAPI (along with an opcode cache) by doing:
yum install mod_php71w php71w-opcache
You can alternatively install PHP 7.1’s php-fpm SAPI (along with an opcode cache by doing:
yum install php71w-fpm php71w-opcache
See the package list below for additional SAPIs and PHP extensions.