Mobile app version of vmapp.org
Login or Join
Vandalay111

: Make a custom Apache handler (for multiple PHP versions) 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

@Vandalay111

Posted in: #Htaccess

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

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

10% popularity Vote Up Vote Down


 

@RJPawlick198

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

AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme