How do you upgrade PHP 5.1 to PHP 5.3 using yum on CentOS

Using Yum/CentOS.

The problem is that php 5.1 is already installed and running so

yum update php

dont work!

I looked around the net for a solution but they say to do the above =/


You'll want to yum install php53. Unfortunately, you will need to remove php (which is php 5.1, see below) first.

php53 is available in CentOS as of CentOS 5.6 and above. It is not available in CentOS 5.5 and previous, unless you go through a third-party repository. That is why many answers on Serverfault tell you to use third party repositories-- that's not necessary anymore.

Note that php53 has many dependencies, so you should consider updating CentOS to the latest CentOS 5.x branch as part of this upgrade (which is CentOS 5.6 as of this writing). This is a major upgrade of PHP, and RedHat forced it through because they were way behind the times as of RHEL5.5.

Note how the package is named php53, while php is php 5.1:

$ yum info php53
Available Packages
Name       : php53
Arch       : x86_64
Version    : 5.3.3
Release    : 1.el5_6.1
Size       : 1.3 M
Repo       : updates
Summary    : PHP scripting language for creating dynamic web sites
URL        : http://www.php.net/
License    : PHP and LGPLv2 and LGPLv2+
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
           : easy for developers to write dynamically generated webpages. PHP also
           : offers built-in database integration for several commercial and
           : non-commercial database management systems, so writing a
           : database-enabled webpage with PHP is fairly simple. The most common
           : use of PHP coding is probably as a replacement for CGI scripts.
           :
           : The php package contains the module which adds support for the PHP
           : language to Apache HTTP Server.

$ yum info php
Available Packages
Name       : php
Arch       : x86_64
Version    : 5.1.6
Release    : 27.el5_5.3
Size       : 2.3 M
Repo       : base
Summary    : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
URL        : http://www.php.net/
License    : The PHP License v3.01
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
           : easy for developers to write dynamically generated webpages. PHP also
           : offers built-in database integration for several commercial and
           : non-commercial database management systems, so writing a
           : database-enabled webpage with PHP is fairly simple. The most common
           : use of PHP coding is probably as a replacement for CGI scripts.
           :
           : The php package contains the module which adds support for the PHP
           : language to Apache HTTP Server.

You need any additional repo to upgrade php as php 5.3 is not yet included in the CentOS Base Repo. You can use the atomic repo which works for me flawlessly,

wget -q -O - http://www.atomicorp.com/installers/atomic | sh
yum upgrade php
yum -y remove atomic-release*

This will install the atomic repo, upgrade php and then remove the atomic-repo (to make sure that any future system update won't install any additional packages from atomic).