I’m going to show you how to upgrade PHP 5.3 to PHP 5.4 on CentOS 6.7. This article is assuming that you are running the CentOS 6.7 default version of PHP 5.3.

 

1. Confirm your version of PHP is the CentOS 6.7 default

 

Type in the following:

 

rpm -qa | grep php

 

Should output similar to the following:

 

php-cli-5.3.3-46.el6_6.x86_64
php-common-5.3.3-46.el6_6.x86_64
php-5.3.3-46.el6_6.x86_64

 

Great, let’s move on.

 

2. Install and activate the REMI and EPEL RPM Repositories

 

Type in the following to download and install the required files:

 

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm

 

Now to enable the REMI repository globally:

 

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

 

Under the section that looks like [remi] make the following changes:

 

[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 

Press CTRL-O to save, and CTRL-X to exit, and we can continue.

 

3. Update PHP from 5.3 to 5.4

 

Easy as pie, simply type in the following:

 

yum -y update php*

 

Once that’s done, we can verify:

 

rpm -qa | grep php

 

And we should see something similar to the below:

 

php-common-5.4.45-1.el6.remi.x86_64
php-5.4.45-1.el6.remi.x86_64
php-cli-5.4.45-1.el6.remi.x86_64

 

Make sure PHP is working correctly:

 

php -v

 

You should see something similar to the following:

 

PHP 5.4.45 (cli) (built: Sep 2 2015 18:54:00)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

 

And that’s all she wrote!