From: barborak at basikgroup dot com
Operating system: Windows XP
PHP version: 6CVS-2006-04-28 (CVS)
PHP Bug Type: IIS related
Bug description: fastcgi-isapi dll runs dynamic servers as filters rather than
responders
Description:
------------
(I apologize if I am reporting this in the wrong place. It seems that
Shane Caraveo's fastcgi-isapi module is now being maintained as part of
the PHP project. This is a great DLL for general FastCGI applications and
not just PHP. The problem I found relates to using it with Perl to run
dynamic servers. As such, it's not terribly relevant to your work but I
thought I'd report it along with patches.)
1. When using the fastcgi-isapi DLL to run dynamic servers, the dynamic
servers are running as FastCGI filters rather than responders. This is due
to a structure's member not being initialized.
2. When using perl as the server executable, it is sometimes necessary to
include arguments like -T and -w. The Args value in the registry is being
ignored for dynamic servers.
Here are the patches I applied to the code in CVS to fix these problems:
--- FCGIProcMgr.cpp Thu Apr 27 14:46:38 2006
+++ FCGIProcMgr.cpp.new Thu Apr 27 14:45:54 2006
@@ -388,7 +388,10 @@
proc->incServers = parent->incServers;
proc->maxServers = parent->maxServers;
proc->timeout = parent->timeout;
- if (path) strncpy(proc->args, path, sizeof(proc->args)-1);
+ proc->isFilter = parent->isFilter;
+ *( proc->args ) = 0;
+ if (parent->args) strncpy(proc->args, parent->args,
sizeof(proc->args)-1);
+ if (path) strncpy(proc->args + strlen (proc->args), path,
sizeof(proc->args)-1 - strlen (proc->args) );
strncpy(proc->bindPath, bindpath, sizeof(proc->bindPath)-1);
if (dwServerImpersonate) {
proc->env.putEnv("_FCGI_NTAUTH_IMPERSONATE_=1");
And I also needed this change to compile it on my machine:
--- fcgi_server.h Thu Apr 27 14:46:38 2006
+++ fcgi_server.h.new Thu Apr 27 14:43:46 2006
@@ -25,6 +25,10 @@
#define FCGI_SERVER_VERSION "2.2.2 0.5.2 beta"
#define FCGI_ENVIRON_VER "FCGI_SERVER_VERSION=" FCGI_SERVER_VERSION
+#if !defined (INVALID_FILE_ATTRIBUTES)
+#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+#endif
+
extern void InitiateServers(char *szExtension);
extern void CheckServers(char *szExtension);
Given these changes and registry settings like the following, I was able
to successfully run perl dynamic servers with the fastcgi-isapi module:
HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI\.pl
In this key, I added the following values:
AppPath REG_SZ c:\tools\perl\5.6.1\bin\MSWin32-x86\perl.exe
Args REG_SZ -T
BindPath REG_SZ
Note that the value of Args is "-T " (with a space). BindPath is empty.
(Perhaps it's not necessary.)
--
Edit bug report at http://bugs.php.net/?id=37238&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37238&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37238&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37238&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37238&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37238&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37238&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37238&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37238&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37238&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37238&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37238&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37238&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37238&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37238&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37238&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37238&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37238&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37238&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37238&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37238&r=mysqlcfg