Installing PHP 5.6.x on CentOS 5.11

Joe • December 8, 2015

devops linux php

Install Nginx, PHP 5.6.15 and PHP-FPM on CentOS 5.11

I know... I know.

But I had to figure it out. So here's what made it happen:

Starting Point:

# cat /etc/redhat-release
CentOS release 5.11 (Final)
# php -v
PHP 5.1.6 (cli) (built: Nov 6 2014 12:25:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Install Extra Repos:

## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
## CentOS 5 and Red Hat (RHEL) 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Enable Repos and install nginx and php:

yum install php-pear
yum install php-pecl-json
yum -- enablerepo=remi,remi-php56 install nginx php-fpm php-common
yum -- enablerepo=remi,remi-php56 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-pecl-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

I had to install php-pear and php-pecl-json before the big install because I was getting warnings:

--> Finished Dependency Resolution
php-pecl-json-1.2.1-4.el5.x86_64 from epel has depsolving problems
  -- > Missing Dependency: php-api = 20041225 is needed by package php-pecl-json-1.2.1-4.el5.x86_64 (epel)
php-pecl-json-1.2.1-4.el5.x86_64 from epel has depsolving problems
  -- > Missing Dependency: php-api = 20041225 is needed by package php-pecl-json-1.2.1-4.el5.x86_64 (epel)
Error: Missing Dependency: php-api = 20041225 is needed by package php-pecl-json-1.2.1-4.el5.x86_64 (epel)
 You could try using -- skip-broken to work around the problem
 You could try running: package-cleanup -- problems
                        package-cleanup -- dupes
                        rpm -Va -- nofiles -- nodigest

Final Result:

# php -v
PHP 5.6.16 (cli) (built: Nov 26 2015 08:10:10)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Your milage may vary. I hope no one ever needs this.