I just did a fresh install of CentOS 6.10 today and needed to install PHP. It had been a while, so I needed a refresher.
Note: PHP 5.6 is pretty much End Of Life, so you should be installing PHP 7.2, or higher at this point in time. That said, sometimes you have to support older systems.
Add some necessary repos:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
curl -O http://rpms.famillecollet.com/enterprise/remi.repo
Edit rum.repos.d (i prefer nano)
The only default repo will be [remi-safe]. Make sure this is enabled.
Then set the [remi-php56] to enabled =1. Default is 0. Make sure to save and close.
You will need to install the latest version of libzip.
yum install -y libzip5
Then install your different php needs. Here’s an example:
yum install -y php php-cli php-common php-gd php-gmp php-mbstring php-mysqlnd php-pdo php-pear.noarch php-pecl-jsonc php-process php-xml runtime php php-devel more-php-mcrypt
Instead of editing yum.repos.d you can use a switch like thus:
yum install -y php --enablerepo=remi-php56