Install PHP 5.3 on CentOS/RHEL

In this tutorial, like other tutorials, I assume that you have the root access to the server. I also assume that you have already installed Apache on your OS. (See installing Apache instructions here)

Notice: If you don’t have former PHP version on your server, just skip this first step and move on to the next step named “Preparing to Install PHP 5.3“.

Removing Previously Installed Versions of PHP

Usually when you get to the conclusion of installing PHP 5.3 on your CentOS or [tooltip content=”RedHat Enterprice Linux” url=”” ]RHEL[/tooltip], a you have already installed earlier version of PHP on your server and you wish to upgrade the version. So First you should remove the previous version from your server:

yum remove php php-*


Preparing to Install PHP 5.3

In this step, you should have a server with Apache and no PHP on your server. I have CentOS 5.5 and I’ve tested this guide on CentOS 6.2 too, so it’s compatible with both and perhaps the versions in-between.

First you should install yum-priorities via yum itself:

yum install yum-priorities

Then there are two .rpm files you should install on your server. you should find the files (the most updated versions) from this website:

When you open this website, you’ll see some numbers which are your OS major version, for example if your OS is CentOS 6.2, you should choose 6. Then in the next page you should select the architecture, then you should replace the URL with the following URL (The following is just a sample):

rpm -Uvh
rpm -Uvh

Now you are fully prepared, let’s move to the next step.


Installing PHP 5.3

This step can be done rapidly, just use this command:

yum -y install php53u-pear php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mcrypt php53u-mysql php53u-pdo php53u-soap php53u-xml php53u-xmlrpc php53u-bcmath php53u-pecl-apc php53u-pecl-memcache php53u-snmp

Now you should restart your Apache via the following command to let your Apache use your brand-new PHP:

service httpd restart

If you face any problem about this tutorial, just leave a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *

This is new type of CAPTCHA, make the puzzle please !WordPress CAPTCHA