Installing PHP 5.6 on CentOS 7

By default, PHP 5.4 is on the official software package repositories of CentOS 7. Since it has reached end of life, it is always recommended to install / upgrade to the latest version of PHP

Install and enable EPEL and Remi repository

By using the commands below, you can install the required repository.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Output:

install epel

install remi

Install yum-utils

This integrates with yum to enhance its default features, giving it more advanced package management options and also making it easier to use.

yum install yum-utils

Installing PHP

You can install PHP 5.6 with all needed modules as follows.

yum-config-manager --enable remi-php56

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Output:

install php56

Check PHP version after the installation

php -v

install phpver