How to Upgrade PHP 5.3 to PHP 5.4 on CentOS 6.7

1. Confirm your version of PHP is the CentOS 6.7

 

Type in the following:

 

rpm -qa | grep php

 

Should output similar to the following:

 

php-cli-5.3.3-48.el6_8.x86_64
php-mysql-5.3.3-48.el6_8.x86_64
php-common-5.3.3-48.el6_8.x86_64
php-pdo-5.3.3-48.el6_8.x86_64
php-5.3.3-48.el6_8.x86_64

 

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

 

Save and exit.

 

3. Update PHP from 5.3 to 5.4

 

Simply type in the following:

 

yum -y update php*

 

Once completed you can check it with:

 

rpm -qa | grep php

 

And we should see something similar to the below:

 

php-cli-5.4.45-12.el6.remi.x86_64
php-5.4.45-12.el6.remi.x86_64
php-common-5.4.45-12.el6.remi.x86_64
php-pdo-5.4.45-12.el6.remi.x86_64
php-mysql-5.4.45-12.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 19 2016 15:31:07)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

LEAVE A COMMENT