Skip to Main Content

Upgrade to PHP 5.6 on CentOS 6

The IUS Community Project is sponsored by Rackspace and offers an easy upgrade path for users on CentOS 6 who are tired of being stuck with PHP 5.3 (or Python 2.6). My experience upgrading to PHP 5.6 was totally painless, by YMMV. The IUS repo is recommended over the Remi repo, because IUS uses package names that are different from the default package names, whereas Remi overrides the defaults.

These instructions assume that you already have a version of PHP installed on your server.

$ cd /tmp

If you don't already have the EPEL repo, install that first. EPEL offers packages that aren't available on standard CentOS (like Fail2Ban and phpMyAdmin). If you're not sure whether you have EPEL, run sudo yum repolist  and see if epel is listed.

// Install the EPEL repo, if necessary
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
$ sudo rpm -Uvh epel-release-6*.rpm

// Install the IUS repo
$ wget https://centos6.iuscommunity.org/ius-release.rpm
$ sudo rpm -Uvh ius-release*.rpm

// Install the IUS replace plugin
$ sudo yum install yum-plugin-replace

// Use the plugin to replace the existing PHP with 5.6
$ sudo yum replace php --replace-with php56u

// You will see some warnings. These warnings are normal.
WARNING: Unable to resolve all providers: [...
Continue? [y/N] y
...
Complete!

// Restart your web server. For Apache it's
$ sudo service httpd restart 

// Check installed PHP version
$ php -v
// should output...
PHP 5.6.25 (cli) (built: Aug 19 2016 11:03:33)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Congratulations, you are now on PHP 5.6! Want to  see what else IUS has available?

// Check for a specific package
sudo yum --enablerepo=ius list python*

// List everything in the IUS repo
sudo yum --disablerepo="*" --enablerepo="ius" list available | more

To learn more, check out the IUS Project website and this installation walkthrough on GitHub. There's also a helpful article by Rackspace. 

 

Most RecentRSS

ArchiveRSS

March 2016 (1)
January 2016 (1)
September 2015 (1)
May 2015 (1)
April 2015 (1)
March 2015 (1)
February 2015 (2)
January 2015 (5)
September 2014 (2)
August 2014 (4)
July 2014 (1)
March 2014 (1)
November 2013 (3)
September 2013 (3)
July 2013 (6)
June 2013 (1)
May 2013 (1)
March 2013 (2)
February 2013 (3)
January 2013 (4)