Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Install PHP 5.6 on CentOS 7.2

CentOS is really slow to update versions of software’s it maintains so we’ll have to add an external repo to install PHP 5.6 on our server.

Make sure you backup everything on your server.

Start off by removing any previous version of PHP you have installed on your server:

Note: The following can cause havoc on your system, be sure you know what you’re removing before proceeding.

yum remove php*

Before hitting ‘y’ make sure you go over the dependencies being removed, you also might want to take note of them to install them back with PHP 5.6.

Start off by installing two repos, epel-release and webtatic:

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

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

With this repo, PHP 5.6 will have to be installed with a different name, to get a list of everything available for PHP 5.6, issue the following:

yum list php56w*

To install:

yum install php56w php56w-cli php56w-common php56w-devel

Restart apache and hit a phpinfo file to verify

service httpd restart

This is what you should see

php 5.6