Saturday, March 27, 2010

Installing PHP 5.3.x on RedHat ES5, CentOS 5, etc

Some cases arise when we want to upgrade php and we do not want to affect any dependencies it has.

Obviously we can use YUM for this ;)
The step below will upgrade your php with all it dependencies to latest version. We have 5.3.1 at the moment.

To install PHP 5.3.1 (latest version) you can make use of a RPM repository maintained by Remi. We will cover here for ES5 stuff.
So first of all we will need to get the latest remi release
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm 
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
You now have the Remi repository on your system, however it is disabled by default. Obviously you don’t want all of your packages been effected by this repository, however to enable it for a specific package, run the following:yum --enablerepo=remi update php
Now you can just run 
php -v
This will give you the version of php.
You can now restart your server.

No comments:

Post a Comment

Developer Instincts