Upgrading the Centos 5 Default PHP (5.1.6) to PHP 5.3

After facing some incompatibility with WebApps and the PHP version 5.1, I’ve upgraded the PHP to version 5.3. We will use PHP 5.3 packages from IUS repository and replace all of the currently installed PHP 5.1 and all of the related packages with the PHP version 5.3.

These are the simple steps:

1. Install the IUS and EPEL repository:

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/i386/ius-release-1.0-6.ius.el5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/i386/epel-release-1-1.ius.el5.noarch.rpm
rpm -Uhv ius-release-1.0-6.ius.el5.noarch.rpm epel-release-1-1.ius.el5.noarch.rpm

2. Edit the ius.repo and make sure it looks like this:

name=IUS Community Packages for Enterprise Linux 5 - $basearch

3. Install the IUS yum plugin (if you missed it from the IUS instructions):

yum install yum-plugin-replace

4. Replace the old stock php:

yum replace php --replace-with php53u

Please look and read carefully at the Dependency Overview. Make sure that the all the dependencies are resolved before answering <y>:

Dependencies Resolved

 Package                        Arch                 Version                                Repository               Size
 php53u                         i386                 5.3.6-1.ius.el5                        ius                     1.6 M
 php53u-cli                     i386                 5.3.6-1.ius.el5                        ius                     3.2 M
 php53u-common                  i386                 5.3.6-1.ius.el5                        ius                     576 k
 php53u-devel                   i386                 5.3.6-1.ius.el5                        ius                     700 k
 php53u-gd                      i386                 5.3.6-1.ius.el5                        ius                     112 k
 php53u-imap                    i386                 5.3.6-1.ius.el5                        ius                      50 k
 php53u-ldap                    i386                 5.3.6-1.ius.el5                        ius                      35 k
 php53u-mbstring                i386                 5.3.6-1.ius.el5                        ius                     1.2 M
 php53u-mcrypt                  i386                 5.3.6-1.ius.el5                        ius                      31 k
 php53u-mssql                   i386                 5.3.6-1.ius.el5                        ius                      41 k
 php53u-mysql                   i386                 5.3.6-1.ius.el5                        ius                      86 k
 php53u-odbc                    i386                 5.3.6-1.ius.el5                        ius                      51 k
 php53u-pdo                     i386                 5.3.6-1.ius.el5                        ius                      65 k
 php53u-pear                    noarch               1:1.9.2-1.ius.el5                      ius                     424 k
 php53u-pgsql                   i386                 5.3.6-1.ius.el5                        ius                      72 k
 php53u-process                 i386                 5.3.6-1.ius.el5                        ius                      37 k
 php53u-pspell                  i386                 5.3.6-1.ius.el5                        ius                      25 k
 php53u-snmp                    i386                 5.3.6-1.ius.el5                        ius                      28 k
 php53u-soap                    i386                 5.3.6-1.ius.el5                        ius                     145 k
 php53u-tidy                    i386                 5.3.6-1.ius.el5                        ius                      34 k
 php53u-xml                     i386                 5.3.6-1.ius.el5                        ius                     112 k
 php53u-xmlrpc                  i386                 5.3.6-1.ius.el5                        ius                      51 k
 php                            i386                 5.1.6-27.el5_5.3                       installed               5.9 M
 php-cli                        i386                 5.1.6-27.el5_5.3                       installed               5.2 M
 php-common                     i386                 5.1.6-27.el5_5.3                       installed               393 k
 php-devel                      i386                 5.1.6-27.el5_5.3                       installed               2.5 M
 php-gd                         i386                 5.1.6-27.el5_5.3                       installed               327 k
 php-imap                       i386                 5.1.6-27.el5_5.3                       installed                96 k
 php-ldap                       i386                 5.1.6-27.el5_5.3                       installed                43 k
 php-mbstring                   i386                 5.1.6-27.el5_5.3                       installed               1.6 M
 php-mcrypt                     i386                 5.1.6-15.el5.centos.1                  installed                32 k
 php-mssql                      i386                 5.1.6-15.el5.centos.1                  installed                48 k
 php-mysql                      i386                 5.1.6-27.el5_5.3                       installed               175 k
 php-odbc                       i386                 5.1.6-27.el5_5.3                       installed                83 k
 php-pdo                        i386                 5.1.6-27.el5_5.3                       installed               100 k
 php-pear                       noarch               1:1.4.9-6.el5                          installed               1.8 M
 php-pgsql                      i386                 5.1.6-27.el5_5.3                       installed               120 k
 php-snmp                       i386                 5.1.6-27.el5_5.3                       installed                24 k
 php-soap                       i386                 5.1.6-27.el5_5.3                       installed               299 k
 php-tidy                       i386                 5.1.6-15.el5.centos.1                  installed                43 k
 php-xml                        i386                 5.1.6-27.el5_5.3                       installed               215 k
 php-xmlrpc                     i386                 5.1.6-27.el5_5.3                       installed                87 k
Installing for dependencies:
 libXaw                         i386                 1.0.2-8.1                              os                      324 k
 libXmu                         i386                 1.0.2-5                                os                       62 k
 libedit                        i386                 20090923-3.0_1.el5.rf                  rpmforge                262 k
 libtool-ltdl                   i386                 1.5.22-7.el5_4                         os                       37 k
 t1lib                          i386                 5.1.2-1.el5.rf                         rpmforge                362 k
Removing for dependencies:
 php-eaccelerator               i386                 5.1.6_0.9.5.2-4.el5.rf                 installed               703 k
 php-mhash                      i386                 5.1.6-15.el5.centos.1                  installed               7.4 k

Transaction Summary
Install      27 Package(s)
Upgrade       0 Package(s)
Remove       22 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Total download size: 9.6 M
Is this ok [y/N]: y

5. If you had the old php and web server running, restart the web server:

service httpd restart

6. If you had a mysql database server running, restart the mysqld:

service mysqld restart

7. Now test your PHP configuration by adding this function to your PHP file and open it from the browser.


 Bergabung Yuk di ICT Laboratory Forum
 Diskusi tentang Cryptography dan Internet Security. Kunjungi  http://forum.ictlab.org


2 responses to “Upgrading the Centos 5 Default PHP (5.1.6) to PHP 5.3

  1. Thheo October 28, 2011 at 3:41 pm

    You should swap steps 2 and 3. If you change ius.repo you cannot install yum-plugin-replace, because you limited the ius.repo to only php*..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: