Install PHP 5.2 on Red Hat Enterprise Linux 5.6

Red Hat Enterprise Linux 5.6 ships with PHP 5.1, and also makes PHP 5.3 available. PHP 5.1 is the default, and the server will never update from 5.1 to 5.3 without being explicitly configured to do so. But you may notice that glaring hole where PHP 5.2 should be. Where does that leave users of several popular PHP-based Content Management Systems? There are a few officially supported releases and myriad plugins and extensions that require PHP 5.2.

The CentOS Testing repository comes to the rescue (CentOS provides a lot of very helpful repositories). They even have a HowTo PHP5.1 to 5.2 page. The problem with this page is that it includes some terribly inconvenient styling. A quick cut and paste yields a config page that carries indentation. Yum will fail to parse your configuration data if it is preceded by a space (or if a comment is preceded by space).

If you attempted to follow the wiki instructions, but instead found yourself staring at a “Config Error: File contains no section headers.” message, check the current CentOS-Testing.repo file on the CentOS/5 server. Notice the absence of any indentation preceding the repository section header, variables, and comments. Either use this version in /etc/yum.repos.d/CentOS-Testing.repo (just make sure you add an “includepkgs=php*” at the bottom!!!), or manually remove the indentation from the CentOS wiki version. After that, a simple “yum update” or “yum update php*” will update your server with PHP 5.2. Apache users need to restart apache with “/sbin/service apache restart” (or your preferred apache restarting technique), and PHP 5.2 is up and running on your web server.

Nicholas Whittier

Nicholas Whittier

Nicholas is a developer who loves to figure out how things work. Whether it is an errant bash script, missing kernel drivers, CSS conflicts, a JRE incompatibility, an unsolved Rubik's cube, or anything in between, he wants to learn why it is broken and how to fix it. Additionally, Nicholas fancies GNU/Linux system administration, database administration, Java development, and web development. 

3 Responses

  1. Below I provided my server’s OS version and release, Could you please tell me if I can upgrade the PHP 5.1.6 to PHP 5.2.6 on that server

    -bash-3.2$ rpm -qa ‘*release*’

    -bash-3.2$ cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 5.5 (Tikanga)

    -bash-3.2$ cat /proc/version
    Linux version 2.6.18-194.el5xen ( (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 22:01:26 EDT 2010

Leave a Reply

Your email address will not be published. Required fields are marked *



Recent Posts

Most Common Tags