Skip to content

Installing PHP 5.3.3 on CentOS 5.5 Tutorial

Update: This tutorial will install PHP 5.3.6

In celebration of CentOS now leading the Linux distribution statistics on web servers, with almost 30% of all Linux servers, we thought it fitting that in this tutorial we will show you how to install PHP 5.3.3 (Supports the Kohana Framework) with APC and Memcached on CentOS 5.5.

The assumption for this CentOS 5.5 tutorial is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

Preliminary Note:

I am using a CentOS 5.5 32bit server in this tutorial:

  • centos01.how2centos.com (IP 10.0.0.3)
# yum install yum-priorities

Installing PHP 5.3 on CentOS 5.5 i386

Install the EPEL i386 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install the IUS i386 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm
# yum install httpd 

NOTE: If you have a previously installed version of PHP run this command.

# yum remove php php-*
# yum 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

UPDATE: The above will install APC version 3.1.9 which does not have the bug mentioned below.

NOTE: Version 3.1.4 of APC has a bug that will give you this error in you error.log file PHP Warning: require(): Unable to allocate memory for pool.

To resolve this do the following

# yum remove php53u-pecl-apc
# yum update php53u-pecl-apc --enablerepo=ius-testing
# vi /var/www/html/phpinfo.php

# chkconfig httpd on
# service httpd start

Finally browse to your phpinfo.php http://10.0.0.3/phpinfo.php and view your newly configured PHP 5.3.3 Apache server.