I will take PHP 5.4 and PHP 7.2 as example:

$ sudo yum install epel-release

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

Install yum-utils packages too:
$ sudo yum install yum-utils

Enable remi repo, run:
$ sudo yum-config-manager --enable remi-php72
$ sudo yum update

Search for PHP 7.2 packages and modules with more command/grep command/egrep command:
$ sudo yum search php72 | more
$ sudo yum search php72 | egrep 'fpm|gd|mysql|memcache'

Sample outputs

php72-php-fpm.x86_64 : PHP FastCGI Process Manager
php72-php-gd.x86_64 : A module for PHP applications for using the gd graphics
php72-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL
php72-php-pecl-mysql.x86_64 : MySQL database access functions
php72-php-pecl-mysql-xdevapi.x86_64 : MySQL database access functions

Finally install php 7.2 on CentOS 7.2:
$ sudo yum install php72

You must install “PHP FastCGI Process Manager” called php72-php-fpm along with commonly used modules:
$ sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache

To make the 72 default installation:

$ scl enable php72 bash

3. Let the Apache handle the php properly:

# Create a backup of your original Apache configuration
sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
#remove the white space at the beginning of each line
sudo sed -i -e 's/^[ \t]*//' /etc/httpd/conf/httpd.conf
#Load config files in the "/etc/httpd/conf.d" directory, if any
sudo sed -i "s|IncludeOptional|#IncludeOptional|" /etc/httpd/conf/httpd.conf
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
sudo sed -i "s|#ServerName www.example.com:80|ServerName localhost|" /etc/httpd/conf/httpd.conf

# DirectoryIndex: sets the file that Apache will serve if a directory is requested.
# This actually allows you to specify a default page to display when a directory is accessed.
sudo sed -i "s|DirectoryIndex index.html|DirectoryIndex index.html index.php|" /etc/httpd/conf/httpd.conf

# Add PHP configuration into Apache
echo "AddType application/x-httpd-php .php" | sudo tee -a /etc/httpd/conf/httpd.conf

4. Tell the Apache to load a specific PHP version

Check the version of PHP modules installed:

ls /usr/lib64/httpd/modules/
libphp5.so mod_authz_groupfile.so mod_dialup.so mod_lbmethod_heartbeat.so mod_proxy_fdpass.so mod_socache_shmcb.so
libphp72.so mod_authz_host.so mod_dir.so mod_log_config.so mod_proxy_ftp.so mod_speling.so
mod_access_compat.so mod_authz_owner.so mod_dumpio.so mod_log_debug.so mod_proxy_http.so mod_ssl.so
mod_actions.so mod_authz_user.so mod_echo.so mod_log_forensic.so mod_proxy_scgi.so mod_status.so
mod_alias.so mod_autoindex.so mod_env.so mod_logio.so mod_proxy.so mod_substitute.so
mod_allowmethods.so mod_buffer.so mod_expires.so mod_lua.so mod_proxy_wstunnel.so mod_suexec.so
mod_asis.so mod_cache_disk.so mod_ext_filter.so mod_macro.so mod_ratelimit.so mod_systemd.so
mod_auth_basic.so mod_cache.so mod_fcgid.so mod_mime_magic.so mod_reflector.so mod_unique_id.so
mod_auth_digest.so mod_cache_socache.so mod_file_cache.so mod_mime.so mod_remoteip.so mod_unixd.so
mod_authn_anon.so mod_cgid.so mod_filter.so mod_mpm_event.so mod_reqtimeout.so mod_userdir.so
mod_authn_core.so mod_cgi.so mod_headers.so mod_mpm_prefork.so mod_request.so mod_usertrack.so
mod_authn_dbd.so mod_charset_lite.so mod_heartbeat.so mod_mpm_worker.so mod_rewrite.so mod_version.so
mod_authn_dbm.so mod_data.so mod_heartmonitor.so mod_negotiation.so mod_sed.so mod_vhost_alias.so
mod_authn_file.so mod_dav_fs.so mod_include.so mod_proxy_ajp.so mod_setenvif.so mod_watchdog.so
mod_authn_socache.so mod_dav_lock.so mod_info.so mod_proxy_balancer.so mod_slotmem_plain.so mod_wsgi.so
mod_authz_core.so mod_dav.so mod_lbmethod_bybusyness.so mod_proxy_connect.so mod_slotmem_shm.so
mod_authz_dbd.so mod_dbd.so mod_lbmethod_byrequests.so mod_proxy_express.so mod_socache_dbm.so
mod_authz_dbm.so mod_deflate.so mod_lbmethod_bytraffic.so mod_proxy_fcgi.so mod_socache_memcache.so

Change the configuration files for the httpd modules

ls /etc/httpd/conf.modules.d/

00-base.conf 00-lua.conf 00-proxy.conf 00-systemd.conf 10-fcgid.conf 10-wsgi.conf
00-dav.conf 00-mpm.conf 00-ssl.conf 01-cgi.conf 10-php.conf 15-php72-php.conf

there are two php configuration file here 10-php.conf which is for php 5.4 shipped out of box with CentOS7 and 15-php72-php.conf which is just installed.

I will comment out all the lines in 10-php.conf:

# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#<IfModule prefork.c>
# LoadModule php5_module modules/libphp5.so

If you have a look at the 15-php72-php.conf:

# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.

# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
 <IfModule prefork.c>
 LoadModule php7_module modules/libphp72.so

This means, if php5 modules is not loaded, then load php7.2 module.

Now restart httpd:

sudo service httpd restart

Create a version check php file:

sudo vi /var/www/html/info.php




Give it permission:

chmod 755 /var/www/html/info.php

Open a browser, and type http://your_domain/info.php. You should see your php version is 7.2