**Update 10/30/04 **
First off, it has been brought to my attention that this DOES NOT work for Linux servers. It has only been successfully tested on FreeBSD servers. In particular a FreeBSD 4.10_STABLE server. I am currently working on a similar solution for Apache on Linux. (Redhat9 in particular)
I think I have finally found a way to do what I need to do with parrallel versions. My situation is my company’s hosting farm doesn’t give us the ability to run two seperate apache servers on one box and I don’t particularly want to run a CGI version due to the loss of $_SERVER variables and other security issues. So I endeavored on a trick to get php5 to use a different mime-type. Well, it’s not a trick, but it’s also probably not obvious to most people how to accomplish this so read on.
The changes I made where to get it to work for Apache 1.3.*. I am not sure if the same changes (different directory) can be applied for it to work with Apache 2.In any case, the file I edited was /sapi/apache/mod_php5.c. Around line 913
change the following values:
- application/x-httpd-php -> application/x-httpd-php5
- application/x-httpd-php-source -> application/x-httpd-php5-source
The changes will be your new mimetypes for use with the AddType directive in PHP. (eg: AddType application/x-httpd-php5 .php)
Then towards line 924 change these values:
- php_value -> php5_value
- php_flag -> php5_flag
- php_admin_value -> php5_admin_value
- php_admin_flag -> php5_admin_flag
The changes here should be used if you want to set php.ini options via your httpd.conf or .htaccess files. (eg: php5_value include_dir "/usr/local/lib/php")
Now, I haven’t found any warning that this won’t work, but I also haven’t found any references to other people doing this. So I would proceed with caution. I am the senior developer for a fairly large web development firm and we currently have versions 4 and 5 co-existing on one of our productions servers. Over the course of almost a month we haven’t had any problems. But that doesn’t mean that problems don’t exist. I am hoping to start a discussion about any possible drawbacks of this method. Let me know your thoughts and whether or not this works for you.