spawn-fcgi.exe does not appear to work in Windows

Added by keathmilligan almost 15 years ago

On Ubuntu, I have a simple FastCGI "Hello, world" app that I can spawn with:

spawn-fcgi -f ./fcgitest -a "" -p 2222 -n

and it works great. But on Windows (both under XP and Vista), spawn-fcgi does not work. I've tried both the WLMP version of lighttpd and the Cygwin version and I get the same results.

If I run:

spawn-fcgi -f ./fcgitest.exe -a "" -p 2222 -n

It just runs and exits with no message. If I omit the "-n", it will say "child exited with: 0". I've tried playing around with various ways of specifying the arguments and sometimes it will say it spawned a child successfully, but the process is not actually running.

I can run the fcgitest program by itself with no error and I've also verified that spawn-fcgi is finding and running it, but it is exiting immediately because FCGI_Accept is returning "-1". I don't know if it is meaningful or not, but after FCGI_Accept fails, errno is 34 "Result too large".

Replies (5)

RE: spawn-fcgi.exe does not appear to work in Windows - Added by icy almost 15 years ago

FCGI_Accept is obviously in your application and there's nothing spawn-fcgi can do about this. Sorry.

RE: spawn-fcgi.exe does not appear to work in Windows - Added by keathmilligan almost 15 years ago

Turns out the problem is that the WLMP version of Lighty uses Cygwin's file-descriptor handling and so anything spawned by its spawn-fcgi needs to be linked against Cygwin as well. If I simply relink my test app against the Cygwin version of libfcgi instead of the mingw version, it works. Since I don't my app to ultimately depend on Cygwin, I had to write a Win32-native version of spawn-fcgi.

I attached the source in case anyone else runs into the same issue. You can compile it with mingw (link with wsock32). It is mostly compatible with the original spawn-fcgi, but does not support chroot or setting uid/gid.

RE: spawn-fcgi.exe does not appear to work in Windows - Added by Dipish about 14 years ago

keathmilligan I got trouble compiling your code with mingw =(
Could you please throw me a hint or a compiled binary of your spawn-fcgi?

C:\Qt\2009.04\mingw\bin>g++ -lwsock32 C:\Qt\Projects\spawn-fcgi\spawn-fcgi-win32
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0xbe): und
efined reference to `inet_addr@4'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0xd5): und
efined reference to `htonl@4'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0xea): und
efined reference to `htons@4'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x133): un
defined reference to `WSAStartup@8'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x13f): un
defined reference to `WSAGetLastError@0'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x186): un
defined reference to `socket@12'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x1e8): un
defined reference to `connect@12'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x22b): un
defined reference to `socket@12'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x2a5): un
defined reference to `setsockopt@20'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x302): un
defined reference to `bind@12'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x367): un
defined reference to `listen@8'
C:\DOCUME~1\Dipish\LOCALS~1\Temp/cc4lNW41.o:spawn-fcgi-win32.c:(.text+0x521): un
defined reference to `closesocket@4'
collect2: ld returned 1 exit status

RE: spawn-fcgi.exe does not appear to work in Windows - Added by tuadmin over 13 years ago


(link with wsock32)
I use CODEBLOCKS program for compile spawn fcgi and use LIB wsock32


si entiendes español; mira yo uso CODEBLOCKS para Compilar con minGW y para hacer correr la compilacion de Spawn-FCGI tienes que hacer un LINK a WSOCK32 que en CODEBLOCkS lo incluye como


en la ruta completa
C:\Program Files\CodeBlocks\MinGW\lib\libwsock32.a

yo use CODEBLOCKS minGW 8.02
ADJUNTO my Spawn Fcgi

spawn-fcgi.exe (414 KB) spawn-fcgi.exe spawnfcgi BIN

RE: spawn-fcgi.exe does not appear to work in Windows - Added by aniljcb over 12 years ago

C:\work\spawn-fcgi>spawn-fcgi -f C:\work\IIPImageServer-0.9.8\iipsrv.fcgi -a 127
.0.0.1 -p 6667
C:\Users\rootciv\Desktop\Mis Proyectos\c++\spawn\main.c.144: CreateProcess faile

Can anyone help me