The PHP packages in the base / epel repositories are very conservative. To opt for something more current the REMI repo can be used.
Install the remi-release package (info) first:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -ivh remi-release-7.rpm
This will create the remi specific repo files in the /etc/yum.repo.d directory, specifically:
remi-php70.repo remi.repo remi-safe.repo
To install later PHP versions alongside your current PHP version you can specify the php56-* or php70-* packages, for example:
yum install php56 php56-php php56-php-cli php56-php-common php56-php-fpm php56-php-gd php56-php-mbstring php56-php-pdo php-mysqlnd
However to replace your existing PHP version (or install 5.6 from scratch) you need to amend the /etc/yum.repo.d/remi.repo file. In that file you should see blocks for the specific versions of PHP. To choose a specific version of PHP set the enabled=0 to enabled=1 for that block. As an example, I wanted to use PHP 5.6 as my default PHP version so I amended the remi.repo file to the following:
[remi-php56] name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/ mirrorlist=http://rpms.remirepo.net/enterprise/7/php56/mirror # NOTICE: common dependencies are in "remi-safe" enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
After that I can install PHP (5.6) with:
yum install php php-cli php-common php-fpm php-gd php-mbstring php-pdo php-mysqlnd
The same method can be used for other PHP versions provided by remi.