Install PHP 7.2 on CentOS from yum
First you need to install Remi repository
Enable epel repo with
yum install epel-release -y
On CentOS 7
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
On CentOS 6
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-6.rpm
Enable PHP 7.2
yum install yum-utils yum-config-manager --enable remi-php72
To install PHP, run
yum install -y php php-bcmath php-cli php-common php-devel php-gd \ php-imap php-intl php-json php-ldap php-lz4 php-mbstring php-mysqlnd \ php-soap php-intl php-opcache php-xml php-pdo
Downgrading PHP version
if you ever want to change PHP version, lets say PHP 7.0, do the following. Remove current PHP
rpm -qa | grep php | xargs yum remove -y
Disable PHP 7.2 repo.
yum-config-manager --disable remi-php72
Enable PHP 7.0 repo
yum-config-manager --enable remi-php70
Now install PHP as above.
PHp Binary
PHP cli will be installed in /usr/bin/php72, you can create a symlink if you want.
PHP-FPM
To install php-fpm module, run
yum install php72-php-fpm -y
To start php-fpm, run
systemctl start php72-php-fpm