[FASTCGI] apache 2.2+fastcgi+cgicc

Tom Donovan Tom at tomdonovan.net
Tue Aug 26 08:57:44 EDT 2008


Jay Sprenkle wrote:
> Good evening all,
> 
> I'm trying to get a fastcgi+cgicc application working and I've run
> into a snag. I'm not sure if it's a bug or I'm using the code
> incorrectly. Any suggestions would be appreciated.
> 
> Here's the setup:
> Apache 2.x (latest version, running on windows xp) is configured to
> start a single instance of my fastcgi application and communicate over
> a tcp connection. I picked a random port in the 9000 range.
> 
...
> 
>     if((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) &&
>        (GetStdHandle(STD_ERROR_HANDLE)  == INVALID_HANDLE_VALUE) &&
>        (GetStdHandle(STD_INPUT_HANDLE)  != INVALID_HANDLE_VALUE) )
> 
> Is this a bug in the fastcgi dll/Apache or am I using it wrong?
> 

Apache 2.2.9 included APR 1.3, which introduced an incompatible change to the way processes are 
created on Windows.  You will need to change mod_fastcgi and rebuild it for Apache 2.2.9 or higher.

Starting with Apache 2.2.9, it is necessary to call apr_procattr_io_set() to correctly configure 
stdin, stdout, and stderr for fastcgi programs before calling apr_procattr_child_in_set().

Here is a patch to fcgi_pm.c which will make mod_fastcgi compatible with Apache 2.2.9+.
The patch affects the WIN32 portion of fcgi_pm.c, as this problem is specific to Windows.

-tom-

--- fcgi_pm.c	2004-04-14 22:01:26.000000000 -0400
+++ fcgi_pm.c	2008-08-26 08:22:15.856008700 -0400
@@ -559,6 +559,10 @@
      if (apr_os_file_put(&file, &listen_handle, 0, tp))
          goto CLEANUP;

+    /* required for APR 1.3+ */
+    if (apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_FILE, APR_NO_FILE))
+        goto CLEANUP;
+
      /* procattr is opaque so we have to use this - unfortuantely it dups */
      if (apr_procattr_child_in_set(procattr, file, NULL))
          goto CLEANUP;




More information about the FastCGI-developers mailing list