Upgrading PHP 5.3.3 to 5.3.17+ or 5.4.44 in CENTOS6

A customer of ours was looking to upgrade their php to 5.3.17+ following the guide:
http://www.rackspace.com/knowledge_center/article/how-to-installupgrade-php-53-for-centos-5x

Unfortunately this guide is specifically tailored for CentOS 5 instead of CentOS 6, which really broke the customers dependencies.

when running the command ‘yum upgrade php’ there were getting the following error:
Error: Package: php-common-5.3.29-4.w5.x86_64 (webtatic) Requires: libcurl.so.3()(64bit) Error: Package: php-snmp-5.3.29-4.w5.x86_64 (webtatic) Requires: libnetsnmp.so.10()(64bit) You could try using –skip-broken to work around the problem You could try running: rpm -Va –nofiles –nodigest

The first thing to do was to

Step 1.

run a "CREATE IMAGE". Just in case.

Step 2.

 
sudo vim /etc/yum.repos.d/webtatic.repo

The file should look like , with enabled=0

[webtatic]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/centos/5/$basearch/
mirrorlist=http://mirror.webtatic.com/yum/centos/5/$basearch/mirrorlist
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

Again, make sure that enabled is now 0. This disables the webtatic repo.

Then re-run:
Step 3:

sudo yum install php php-cli php-gd php-mysql php-mbstring

This fixed all their badly borked deps. Then the next step was to get the latest PHP 5 support , and show the customer how to use the correct repository, and even after overcoming the dependency issues, there was a new issue now,

Error: php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64

Solving this was quite simple too, after an hour or so of research.

Step 1: Make Backup

please make a backup image before carrying out this procedure to ensure you have a roll back point.

Step 2 : Check PHP Packages

 yum list installed | grep php

Step 3: Use correct webtatic repository

 rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

Step 4: Install yum replace package addin and replace php-common conflicted package with php54w-common

yum install yum-plugin-replace
yum replace php-common --replace-with=php54w-common

Step 5:

yum install php54w.x86_64 php54w-cli.x86_64 php54w-common.x86_64 php54w-gd.x86_64 php54w-ldap.x86_64 php54w-mbstring.x86_64 php54w-mcrypt.x86_64 php54w-mysql.x86_64 php54w-pdo.x86_64

I have tested this and it does seem to work. However, again, please make a backup image before carrying out this procedure to ensure you have a roll back point. I also don’t recommend doing it.

Well, it worked, yay

[root@centos6test ~]# php -v
PHP 5.4.44 (cli) (built: Aug  9 2015 13:45:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies