Rackspace Community

cloud images

How to install/upgrade PHP 5.3 for CentOS 5.x

Article ID: 1237

Last updated on January 10, 2013

Authored by: Rackspace Support

The following article will guide you through installing PHP 5.3 on your CentOS 5.x-based system using the third party webtatic and EPEL package repositories. These package repositories are not officially supported by CentOS, but they provide much more current versions of popular applications like PHP. This guide does not attempt to install the official php53 package set as the available modules in that set are quite limited.

Install the extra repositories

The first step requires downloading and installing some RPM files that contain the additional repository definitions, which we'll do with the rpm command:

Enable the webtatic repository

The webtatic repository provides a variety of up-to-date packages that are useful or are a requirement for many popular web-based services. That means it generally is not a bad idea to enable the webtatic repository by default.

First, open the /etc/yum.repos.d/webtatic.repo repository file using a text editor of your choice,

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

Edit the [webtatic] section of the file so that the enabled option is set to 1. This will enable the remi repository.

To search for available PHP-related packages we can run the following command:

yum search php

Typically the names of php modules begin with php-. Be careful about any packages that start with php53- as these will conflict with the webtatic versions.

Once you've installed PHP and any required supporting modules, skip to the "Last Steps" section below.

Upgrading to PHP 5.3 packages

If you already have PHP installed the upgrade steps are slightly different.

Warning: Before performing this upgrade please take the time to do a full backup of your system. The upgrade should generally be straightforward, but this will depend on the existing package state of your system.