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/lSFWmpHTX1 Patrick Stewart talks about meeting Sting on the set of DUNE (Funny to the EXTREME)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/pmXSmod4ti Anonymous - This will Change Everything You Know... (2018-2019)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/GkwTCvBfes Will Artificial Intelligence Take Over The World?

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/Y1ulafmsC6 Frank Abagnale: "Catch Me If You Can" | Talks at Google

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/NBdW2xFnqD ETS2: Special Transport DLC Trailer