July 11, 2011

Install PHP 5.3 on CentOS 5.6

This article will outline the process for install PHP 5.3.x on CentOS 5.6 via the Enterprise Linux (EPEL) repository.

System Update

First of all, complete a yum update on your machine by running:

# yum update

If a kernel update occurs I recommend rebooting before completing the rest of the steps in this outline.

Install Repositories

In order to upgrade your PHP and MySQL environment you will need to install two repositories, one from the Fedora site and one from Famillecollet (remi).

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Apache & PHP Update

Once the repo’s are installed you can  complete the install (or upgrade) of MySQL, Apache and PHP:

# yum –enablerepo=remi install mysql-server
# yum –enablerepo=remi install httpd php php-common
# yum — enablerepo=remi install php-pear php-pdo php-mysql php-gd php-mbstring php-mcrypt php-xml php-dom

Enable & Restart Services

# chkconfig -–add httpd
# chkconfig –-add mysqld
# service httpd start
# service mysqld start

Secure MySQL

# mysql_secure_installation

Testing

Once you have completed these steps, test you are running PHP 5.3 by executing:

# php -v

From the command line.

Thanks it…