Friday, June 17, 2016

How to Upgrade PHP 5.3 to PHP 5.4 on CentOS 6

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
if nano not found then use this command only.
yum install nano

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

No comments:

Post a Comment