How to Install php 5.3 on CentOS or RHEL

In this guide, i will show you how to install php 5.3 installation using webtatic repository. This steps has been tested on CentOS 5.5 64 bit. However, it same goes to 32 bit OS on CentOS or RHEL.

To install basic php packages, please use this yum command:

[root@server /]# yum --enablerepo=webtatic install php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: ftp.oss.eznetsols.org
 * base: ftp.oss.eznetsols.org
 * extras: ftp.oss.eznetsols.org
 * updates: ftp.oss.eznetsols.org
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.5-1.1.w5 set to be updated
--> Processing Dependency: php-cli = 5.3.5-1.1.w5 for package: php
--> Processing Dependency: php-common = 5.3.5-1.1.w5 for package: php
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-common.x86_64 0:5.3.5-1.1.w5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch           Version               Repository        Size
================================================================================
Installing:
 php                x86_64         5.3.5-1.1.w5          webtatic         1.3 M
Installing for dependencies:
 php-cli            x86_64         5.3.5-1.1.w5          webtatic         2.5 M
 php-common         x86_64         5.3.5-1.1.w5          webtatic         567 k

Transaction Summary
================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 4.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-common-5.3.5-1.1.w5.x86_64.rpm                | 567 kB     00:00
(2/3): php-5.3.5-1.1.w5.x86_64.rpm                       | 1.3 MB     00:00
(3/3): php-cli-5.3.5-1.1.w5.x86_64.rpm                   | 2.5 MB     00:00
--------------------------------------------------------------------------------
Total                                           8.8 MB/s | 4.3 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-common                                               1/3
  Installing     : php-cli                                                  2/3
  Installing     : php                                                      3/3

Installed:
  php.x86_64 0:5.3.5-1.1.w5

Dependency Installed:
  php-cli.x86_64 0:5.3.5-1.1.w5         php-common.x86_64 0:5.3.5-1.1.w5

Complete!

To install the php packages that will integrate with MySQL and will manage through phpMyAdmin, please follow below yum command:

[root@server /]# yum --enablerepo=webtatic install php php-mbstring php-common 
php-pdo php-mysql php-cli php-mcrypt php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: ftp.oss.eznetsols.org
 * base: ftp.oss.eznetsols.org
 * extras: ftp.oss.eznetsols.org
 * updates: ftp.oss.eznetsols.org
addons                                                   |  951 B     00:00
base                                                     | 2.1 kB     00:00
extras                                                   | 2.1 kB     00:00
updates                                                  | 1.9 kB     00:00
webtatic                                                 |  951 B     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-cli.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-common.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-gd.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-mbstring.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-mcrypt.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-mysql.x86_64 0:5.3.5-1.1.w5 set to be updated
---> Package php-pdo.x86_64 0:5.3.5-1.1.w5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch          Version                Repository       Size
================================================================================
Installing:
 php                 x86_64        5.3.5-1.1.w5           webtatic        1.3 M
 php-cli             x86_64        5.3.5-1.1.w5           webtatic        2.5 M
 php-common          x86_64        5.3.5-1.1.w5           webtatic        567 k
 php-gd              x86_64        5.3.5-1.1.w5           webtatic        107 k
 php-mbstring        x86_64        5.3.5-1.1.w5           webtatic        1.2 M
 php-mcrypt          x86_64        5.3.5-1.1.w5           webtatic         30 k
 php-mysql           x86_64        5.3.5-1.1.w5           webtatic         90 k
 php-pdo             x86_64        5.3.5-1.1.w5           webtatic         64 k

Transaction Summary
================================================================================
Install       8 Package(s)
Upgrade       0 Package(s)

Total download size: 5.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): php-mcrypt-5.3.5-1.1.w5.x86_64.rpm                |  30 kB     00:00
(2/8): php-pdo-5.3.5-1.1.w5.x86_64.rpm                   |  64 kB     00:00
(3/8): php-mysql-5.3.5-1.1.w5.x86_64.rpm                 |  90 kB     00:00
(4/8): php-gd-5.3.5-1.1.w5.x86_64.rpm                    | 107 kB     00:00
(5/8): php-common-5.3.5-1.1.w5.x86_64.rpm                | 567 kB     00:00
(6/8): php-mbstring-5.3.5-1.1.w5.x86_64.rpm              | 1.2 MB     00:00
(7/8): php-5.3.5-1.1.w5.x86_64.rpm                       | 1.3 MB     00:00
(8/8): php-cli-5.3.5-1.1.w5.x86_64.rpm                   | 2.5 MB     00:00
--------------------------------------------------------------------------------
Total                                           8.2 MB/s | 5.7 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-common                                               1/8
  Installing     : php-cli                                                  2/8
  Installing     : php-pdo                                                  3/8
  Installing     : php-mcrypt                                               4/8
  Installing     : php-mbstring                                             5/8
  Installing     : php                                                      6/8
  Installing     : php-mysql                                                7/8
  Installing     : php-gd                                                   8/8

Installed:
  php.x86_64 0:5.3.5-1.1.w5               php-cli.x86_64 0:5.3.5-1.1.w5
  php-common.x86_64 0:5.3.5-1.1.w5        php-gd.x86_64 0:5.3.5-1.1.w5
  php-mbstring.x86_64 0:5.3.5-1.1.w5      php-mcrypt.x86_64 0:5.3.5-1.1.w5
  php-mysql.x86_64 0:5.3.5-1.1.w5         php-pdo.x86_64 0:5.3.5-1.1.w5

Complete!