Update PHP to 5.5 on CentOS 6.4

Update PHP to 5.5 on CentOS 6.4

Today I had to update a server running CentOS 6.4 to have PHP 5.5. This is actually easier than you may think.

Firstly I did a yum update this updated the server to version 6.5 and on to PHP. First PHP 5.5 is not in the main repositories so we need to enable the remi repo and while we are at it the epel repo.
So make sure you have wget

sudo yum install wget

Then download the epel and remi repos:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Now enable the remi repo (I like to use nano, which nicer I think than vi):

sudo nano /etc/yum.repos.d/remi.repo

Now change enabled to 1 on the [remi] and on the [remi-php55]. so those sections should look like:

[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

To update your PHP to 5.5 you only have to do:

sudo yum update
sudo service httpd restart

And that's it you have php 5.5 to check:

[[email protected] ~]# php -v
PHP 5.5.11 (cli) (built: Apr  3 2014 07:55:14) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

Now PHP 5.5 has and OPcache build in to so to take advanage of that we do:

sudo yum install php-opcache
sudo service httpd restart

Now your PHP has built in cache support which will make your scripts faster.

Happy coding!


18/04/2014 16:20:00 Shaun Freeman Filed Under: Linux CentOS, PHP, Server

Twitter Feed
Shaun Freeman @Zendmaster

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/8nGfvmdsI2 From Carnivore Diet to Near-Death: Lessons Learned From Today's Most Popular Fad Diet

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/EFLh2y3I24 Carnivore Diet – Myths about Meat – Phil Escott – WHIS 2018

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/dTcBFM4q5A WHY I STOPPED BEING VEGAN | MY STORY

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/RVuVCieSsD Dr. Paul Mason - 'Low Carb from a Doctor's perspective'

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/MFRRuBG23F It's Already Too Late - Elon Musk