To change PHP Version please follow below steps

Step 1) Remove the earlier php with yum remove php*

Step 2) Enable repo as per your requirement

  1. For php 5.6 yum-config-manager –enable remi-php56
  2. For php 7.2 yum-config-manager –enable remi-php72

Step 3) You can also edit /etc/yum.repos.d/remi.repo if you wish to change manually

After changing repo do “yum update”

Step 4) Then do php install depending on Step 2 “yum install php56” or “yum install php72”

Step 5) Install all required modules with “sudo yum install php php-mysql” <…… any other php modules required>

How to change PHP Version