PHP4 and PHP5 needed on the same site


Aug 12, 2011
Let me start by saying I am a website developer and really know nothing when it comes to server administration so please make your answers as complete as possible and don't assume I know anything at all.

I was recently hire to fix a site that was broken after previous developer made some additions to the site. After doing some investigation I found the problem to be the fact that the new addition required PHP5 whereas some of the code is dependent on PHP4. It's actually one group of folders that require the PHP4.

The current configuration is

Default PHP Version (.php files) 5
PHP 5 Handler dso
PHP 4 Handler cgi
Apache suEXEC on

I created a .htaccess file with "AddHandler application/x-httpd-php4 .php .php4 .php3" and put it in the folder where PHP4 is needed and now I get:

"# If you customize the contents of this wrapper script, place # a copy at /var/cpanel/conf/apache/wrappers/php4 # so that it will be reinstalled when Apache is updated or the # PHP handler configuration is changed exec /usr/php4/bin/php "

That is pretty much Greek to me. Can someone walk me through what needs to be done to make this function properly?

Thanks for your time!


Quality Assurance Analyst
Staff member
Oct 2, 2010
somewhere over the rainbow
cPanel Access Level
Root Administrator
I put the following into the .htaccess file on a subfolder to get CGI working with PHP4 for a test account:

Action application/x-httpd-php4 /cgi-sys/php4
AddType application/x-httpd-php4 .php4 .php .php3 .php2 .phtml
This matches exactly what /usr/local/apache/conf/php.conf would have if PHP 4 with CGI were the default. Normally, the best way to troubleshoot exactly what is needed for the .htaccess would simply be to switch to PHP 4 as the default, copy what it uses in /usr/local/apache/conf/php.conf and then use that in the .htaccess for the account. At that point, you can then switch it back to PHP 5 as the default again.

To see this working:

phpinfo() <-- PHP 4 with CGI set by .htaccess
phpinfo() <-- PHP 5 with DSO set as default


Aug 12, 2011
How do I find /usr/local/apache/conf/php.conf ? Please give as much detail as possible please.