How can I run two PHP4 versions (ie 4.0.6 and 4.1.2) with two PHP-ini on IIS without recompiling?
Feb 27th, 2008 23:58
dman, Jean-Marc Molina, Christoph Grottolo, Ayse Geertsma, http://www.ttnr.org
You can do that if you use CGI:
You need to install the two versions into separate directories (e.g.
c:\php406 and c:\php421. Keep the php.ini in the php directory itself
and make shure, that there is no file which starts with php... in the
windows or the system32 directory.
In IIS you can either use a different extension for every php version
(e.g. .php406 and .php411) in order to point to the different versions
or you can use more than one site with the same base directory and
then map .php to the different versions you want to use.
Windows 2000 Pro/IIS 5 note (Added by Jean-Marc Molina on May, 15th
If you don't copy the php.ini file to your Windows directory
(C:\WINNT), you should get the following error: "Security Alert! The
PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the manual
page for CGI security.
For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page."
As specified in your php.ini file, cgi.force_redirect is set to 0 for
IIS ("You CAN safely turn this off for IIS, in fact, you MUST."). So
you can't set it to 1 (true) nor cgi.redirect_status_env to a system
environment variable. Which means you CAN'T "run two PHP4 versions with
two PHP-ini on IIS". It doesn't work in IIS/PHP CGI mode and It won't
work in IIS/PHP ASPI mode. Because ISAPI filters are only available for
the server not for Virtual Directories.
My solution is to use Apache as a Web Server. This is the only solution
I came out with even if my Web Server used to run with IIS under
Windows 2000. If anyone can point us to an IIS solution, I would be
glad to hear it.
For more information please check out the following references:
Macromedia - DevNet Setting Up PHP for Microsoft IIS:
(ISAPI filters for the web server only)