Upgrade from PHP 5.1.x to PHP 5.3.x – PHP 51 to 53 in CentOS

CentOS comes out of the box with PHP 5.1.x which is not secure and is no longer supported.  To upgrade all you need to do is the following. This tutorial is for CentOS 5.6.

1. Stop the Apache Web Server:

# service httpd stop

 

2. Remove the 5.1.x PHP Packages:

# yum remove php php-*

 

3. Install PHP 5.3.x

# yum install php53-cli php53-common php53-devel php53-gd php53-mbstring php53-mysql php53-soap php53-xml php53-xmlrpc php53-bcmath php53-snmp

Some additional php files to install could be

# yum install php53-imap php53-ldap php53-odbc

3. Start Apache

# service httpd start

NOTE: The following packages are not available with php53, php53u does contain most of these.

  • php53-mcrypt -> Not available anymore in CentOS 5.6. A Workaround would be IUS Community Link or build by yourself.
  • php53-mhash -> mhash has been replaced by hash
  • php53-pear -> Check the Bug 673521 from RedHat
  • php53-pecl-apc -> Not available anymore in CentOS 5.6
  • php53-pecl-memcache -> Not available anymore in CentOS 5.6
  • php53-pdo -> will be installed together with soap

 4. Check to see current PHP version

# php -v 

you should see someting like the following

PHP 5.3.3 (cli) (built: Mar 30 2011 13:51:54) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Timezone Setting in PHP 5.3!

In PHP 5.3 it is required to use the date.timezone setting or the date_default_timezone_set() function.

Add

date.timezone = “your time zone here”

to /etc/php.ini.

No comments yet.

Leave a Reply