Long story short… I needed a way for a specific folder to use PHP 5.3 and to keep using PHP 5.2 for the rest of the system, and I needed to do this without breaking the existing CPanel (blergh) configuration (Luckily the system was already using suphp – if yours isn’t just change it using easyapache) .

In the end it was easier than I thought…

  1. Compile and install PHP 5.3 to a folder under /opt
  2. Add Application Handler to Apache Configuration
  3. Add Handler to htaccess on the folders I needed the PHP5.3 (this could also be done within the VHost config)

Read the rest of the post for the full details

cd /usr/src

wget http://us.php.net/get/php-5.3.8.tar.gz/from/this/mirror

tar xfz php-5.3.8.tar.gz

cd php-5.3.8


make install

cp php.ini-production /opt/php53/lib/php.ini

Don’t forget to change your options on the previous file (like timezone)

Edit /opt/suphp/etc/suphp.conf, look for the line containing “application/x-httpd-php5” and add the following line after it:


Edit /usr/local/apache/conf/includes/post_virtualhost_global.conf:

suPHP_AddHandler application/x-httpd-php53

Now you just need to add:

AddHandler application/x-httpd-php53 .php

to an .htaccess on the folders you need to use with PHP5.3