htaccess addhandler not working when changed.

  1. Main site.com - is running php4
  2. sub.site.com - needs to run php5 i've added in the following Addhandler:

    AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml .tpl .html

    AddHandler application/x-httpd-php .php .tpl .html .phtml

no luck on any of those. 3. i added a test.php with phpinfo() on the sub.site.com and its reading php4... 4. went to the Main site.com and removed the Addhandler for php4 retested the test.php on sub.site.com and it read php5 (which is the system default) the script also loaded perfect fine.

for some reason the htaccess under Main site.com is effecting the entire domain. why would something like this happen?


Yes you can only load one php module. When you want to set the Handler in .htaccess for different php versions you should run fastcgi with the different modules.

Here is a short manual HowToForge

  • didn't know that. so a website can't having multiple PHP version running controlled by the .htaccess unless fastcgi is setup? – acctman Mar 5 '11 at 1:03
  • The problem is to load both php modules in apache2. I know that you have problems without cgi. The way over cgi is the common way. – René Höhle Mar 5 '11 at 1:07
  • I'm using cPanel/WHM and my PHP is configured as Default PHP: 5, PHP 5 Handler: dso, PHP 4 Handler: cgi, Apache suEXEC: on.... so it looks like I already have both php 4 & 5 separate. Should i put PHP4 as FCGI and leave PHP5 as DSO or PHP4 CGI and PHP5 FCGI? – acctman Mar 5 '11 at 1:10
  • For performance reason its good when PHP5 run in FCGI. – René Höhle Mar 5 '11 at 1:19
  • ok php5 is set to FCGI and i have dso, cgi and none as option for PHP4? any recommendations? – acctman Mar 5 '11 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.