网上这个教程有点泛滥,大多数都在讲什么要先安装yum downloadonly这个插件,经实践,这个并不是必须的。我是在国外的网站上看到这样的用法:
通常他会给你个rpm报的地址:

https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

类似上面的地址,其实我们要做的很简单,加一条命令就行了:

rpm -Uvh ​​https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm​​​
rpm -Uvh ​​​https://mirror.webtatic.com/yum/el7/webtatic-release.rpm​

或者:

sudo yum localinstall –nogpgcheck ​​https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm​

这就表示已经安装好了rpm包,然后我们就可以使用yum来搜索包了,上面的两个rpm包是php最新集成包,命令如下:

yum search php72

结果如下:

mod_php72w.x86_64 : PHP module for the Apache HTTP Server
php72w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php72w-cli.x86_64 : Command-line interface for PHP
php72w-common.x86_64 : Common files for PHP
php72w-dba.x86_64 : A database abstraction layer module for PHP applications
php72w-devel.x86_64 : Files needed for building PHP extensions
php72w-embedded.x86_64 : PHP library for embedding in applications
php72w-enchant.x86_64 : Enchant spelling extension for PHP applications
php72w-fpm.x86_64 : PHP FastCGI Process Manager
php72w-gd.x86_64 : A module for PHP applications for using the gd graphics library
php72w-imap.x86_64 : A module for PHP applications that use IMAP
php72w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases
php72w-intl.x86_64 : Internationalization extension for PHP applications
php72w-ldap.x86_64 : A module for PHP applications that use LDAP
php72w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php72w-mysql.x86_64 : A module for PHP applications that use MySQL databases
php72w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php72w-odbc.x86_64 : A module for PHP applications that use ODBC databases
php72w-opcache.x86_64 : An opcode cache Zend extension
php72w-pdo.x86_64 : A database access abstraction module for PHP applications
php72w-pdo_dblib.x86_64 : MSSQL database module for PHP
php72w-pear.noarch : PHP Extension and Application Repository framework
php72w-pecl-apcu.x86_64 : APCu - APC User Cache
php72w-pecl-apcu-devel.x86_64 : APCu developer files (header)
php72w-pecl-geoip.x86_64 : Extension to map IP addresses to geographic places
php72w-pecl-igbinary.x86_64 : Replacement for the standard PHP serializer
php72w-pecl-igbinary-devel.x86_64 : Igbinary developer files (header)
php72w-pecl-imagick.x86_64 : Provides a wrapper to the ImageMagick library
php72w-pecl-imagick-devel.x86_64 : Imagick developer files (header)
php72w-pecl-libsodium.x86_64 : Wrapper for the Sodium cryptographic library
php72w-pecl-memcached.x86_64 : Extension to work with the Memcached caching daemon
php72w-pecl-mongodb.x86_64 : PECL package MongoDB driver
php72w-pgsql.x86_64 : A PostgreSQL database module for PHP
php72w-phpdbg.x86_64 : Interactive PHP debugger
php72w-process.x86_64 : Modules for PHP script using system process interfaces
php72w-pspell.x86_64 : A module for PHP applications for using pspell interfaces
php72w-recode.x86_64 : A module for PHP applications for using the recode library
php72w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
php72w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php72w-tidy.x86_64 : Standard PHP module provides tidy library support
php72w-xml.x86_64 : A module for PHP applications which use XML
php72w-xmlrpc.x86_64 : A module for

然后我们就安装最新版本的php7.2,命令如下:

yum install php72w-common php72w-fpm php72w-opcache php72w-gd php72w-mysqlnd php72w-mbstring php72w-pecl-redis php72w-pecl-memcached php72w-devel

这就把php7.2给安装好了!常用的拓展也装好了。
更多参考: