Before you install PHP 7.2, please make sure that your yum tool is properly configured and working. Below are the simple steps to install PHP 7.2 in CentOS 7.
1. Install EPEL repo.
# yum install epel-release -y
2. Install Remi repo.
# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
3. Install additional yum tools.
# yum install yum-utils -y
4. Configure yum for PHP 7.2 repo.
# yum-config-manager --enable remi-php72
5. Now install PHP 7.2.
# yum install php -y
6. Check PHP Version using following command.
# php -v
PHP 7.2.15 (cli) (built: Feb 5 2019 19:50:47) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
That’s All ! You have successfully installed PHP 7.2 on CentOS 7.