Install PHP 7.x on CentOS 7

Whenever I install CentOS, it never comes with PHP 7 or its repositories installed. Since settling for PHP 5 is not an option any more, I manually install the PHP 7 remi repository and PHP 7.2 (or 7.1, 7.0) itself. This is done as follows.

First, make sure epel-release and yum-utils are installed.

sudo yum install epel-release
sudo yum install yum-utils

Install the remi PHP 7 repo:

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Enable the desired repository. For 7.2:

sudo yum-config-manager --enable remi-php72
sudo yum update

Then, install PHP:

sudo yum install php72

Lastly, make a symbolic link between /usr/bin/php and /usr/bin/php72.

 sudo ln -s /usr/bin/php72 /usr/bin/php


Source: https://www.cyberciti.biz/faq/how-to-install-php-7-2-on-centos-7-rhel-7/