[Linux]: How to forcefully upgrade php from 5.1.6 to 5.3.3 using yum on CentOS/Fedora/RHEL

Updated on September 2, 2017

Recently was installing wordpress 3.8 for a client on a Linux machine with CentOS distribution. The sytem had PHP 5.1.6 already installated. But the latest wordpress installation requires PHP 5.2.4 or later. So did yum install to find latest package to install and to my astonishment, how many times ever i do with various repositories, i get the same error message as shown below:

[root@catest yum.repos.d]# yum install php
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package php-5.1.6-40.el5_9.x86_64 already installed and latest version
Nothing to do

But PHP has to be upgraded atleast to 5.2.4 or more at any cost. The only option left was to install through source compilation. But this looked little scary as to fulfill all the dependencies manually.

The other quick solution which i found out to install PHP5.3.3 version using YUM is as follows:

Remove older PHP packages using yum erase

Firstly remove the older php installation using yum remove command as shown below:

[root@catest ~]# yum remove php php-cgi php-cli php-common
Remove older PHP using yum
Remove older PHP using yum

Install PHP5.3.3 using yum install

Install PHP5.3.3 using yum by issuing the below command:

PHP53 installation using YUM
PHP53 installation using YUM

Verify the php version

Verify the latest installed php version :

[root@catest yum.repos.d]# php --version
PHP 5.3.3 (cli) (built: Oct 1 2013 18:32:37)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Was this article helpful?

Related Articles

Leave a Comment