Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
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. –  Stony 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. –  Stony 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 posting your answer, you agree to the privacy policy and terms of service.

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