Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've successfully installed PHP 5.2 and it runs as CGI.

(5.3 is my default running on mod, or as the phpinfo says "Server API: Apache 2.0 Handler")

Ultimately I want to put something like AddHandler application/x-httpd-php52 in the .htaccess file of the directory I want to run it in. is that defined somewhere? (since in compiled php 5.2 myself)

However, this only really works in virtual hosts because I can't wrap my head around how to define a custom handler.

<FilesMatch "\.php">
SetHandler application/x-httpd-php5
</FilesMatch>
ScriptAlias /php52-cgi /usr/lib/cgi-bin/php52-cgi
Action application/x-httpd-php5 /php52-cgi
AddHandler application/x-httpd-php5 .php

How can I do something like AddHandler application/x-httpd-php52 in the .htaccess?

share|improve this question
add comment

2 Answers 2

I've figured it out.

in /etc/apache/apache2.conf (or httpd.conf)

ScriptAlias /php52-cgi /usr/lib/cgi-bin/php52-cgi
Action application/x-httpd-php52 /php52-cgi

in .htaccess (or virtualhost)

<FilesMatch "\.php">
SetHandler application/x-httpd-php52
</FilesMatch>
#AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

(don't seem to need the AddHandler, just the FilesMatch, can anyone explain why?)

I mostly followed the instructions here

share|improve this answer
add comment

Create or edit an .htaccess file and add the following:

AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
share|improve this answer
    
that doesnt work. i even kept all the directives in the 000-default virtualhosts, not go either. did i mention that 5.3 is my default for everything running on mod. –  petergus Dec 14 '12 at 8:43
    
No, you didn't. All you've mentioned is 5.2. –  bobthyasian Dec 14 '12 at 8:46
    
sorry, ive updated my question, i hope its more clear? (still working on my questions skills here) :) or? Yes, im running 5.3 as default and want to run certain directories in 5.2 –  petergus Dec 14 '12 at 9:33
add comment

Your Answer

 
discard

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.