1

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?

acctman
  • 214
  • 1
  • 5
  • 11

1 Answers1

1

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

René Höhle
  • 1,438
  • 3
  • 17
  • 26
  • didn't know that. so a website can't having multiple PHP version running controlled by the .htaccess unless fastcgi is setup? – acctman Mar 05 '11 at 01: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 05 '11 at 01: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 05 '11 at 01:10
  • For performance reason its good when PHP5 run in FCGI. – René Höhle Mar 05 '11 at 01:19
  • ok php5 is set to FCGI and i have dso, cgi and none as option for PHP4? any recommendations? – acctman Mar 05 '11 at 01:37
  • When you look into the HowToForge Tutorial in my post they install php5 as DSO and php4 as cgi. Perhaps you get there some more detailed information. The problem is, that in this Tutorial thy put php4 to .php4. When you want both on .php you should set both versions to php and set the handler in the .htaccess file. I think you should try it ;) – René Höhle Mar 05 '11 at 01:44