Monday, December 28, 2009

Installing PHP 5.2.x on Centos

Recently I have got into issue where the PHP framework requires php 5.2.x while the installed system of centos 5.4 have php 5.1.x.

The Testing repo of centos have php 5.2.x, I followed the following steps to install the php 5.2.x from centos dev repository.

Method 1:  Which will install all the new packages from Centos Testing repo.

sudo vi /etc/yum.repos.d/Centos-Test.repo


[c5-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=0
gpgcheck=1
priority=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

# CentOS-Testing:
# !!!! CAUTION !!!!
# This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
# They may or may not replace core CentOS packages, and are not guaranteed to function properly.
# These packages build and install, but are waiting for feedback from testers as to
# functionality and stability. Packages in this repository will come and go during the
# development period, so it should not be left enabled or used on production systems without due
# consideration.


If you are using "yum-priorities" like me then you also have to add the following to the above

priority=1

Now install the updates

sudo yum --enablerepo=c5-testing update <--- this will install php 5.2.x along with other latest packages from Centos dev repo.

I am not sure how safe its to enable testing repository on production server in my case its a testing server so I can play with it.

Method 2: Only install php 5.2.x and related packages from Centos Testing Repo

sudo yum --enablerepo=c5-testing update php-*

=============================================================================================================================================================
 Package                               Arch                          Version                                       Repository                           Size
=============================================================================================================================================================
Updating:
 php                                   i386                          5.2.9-2.el5.centos                            c5-testing                          1.2 M
 php-cli                               i386                          5.2.9-2.el5.centos                            c5-testing                          2.4 M
 php-common                            i386                          5.2.9-2.el5.centos                            c5-testing                          237 k
 php-mbstring                          i386                          5.2.9-2.el5.centos                            c5-testing                          1.1 M
 php-mysql                             i386                          5.2.9-2.el5.centos                            c5-testing                           80 k
 php-pdo                               i386                          5.2.9-2.el5.centos                            c5-testing                           62 k

Transaction Summary
=============================================================================================================================================================

This will install the php packages

For more information click Centos Repositories.

No comments:

Post a Comment