Fake FastCGI Web Server

When developing a new FastCGI library, the web server can get in the way. The attached program wraps a FastCGI executable in a minimal FastCGI environment. It should be enough to get "hello world" working. It only uses named pipes. It doesn't exercise all FastCGI protocol features. Sample PHP 5 run:

C:\>fakefcgi.exe c:\Inetpub\wwwroot\hello.php c:\php\php-cgi.exe

Fake FastCGI web server
FCGI_PARAMS sent
FCGI_STDIN sent
Launching receive loop
FCGI_STDOUT: X-Powered-By: PHP/5.2.1RC2-dev
Content-type: text/html

Hello World 2 from IIS

FCGI_END_REQUEST received
killing app
FastCGI process exited with 0

C:\>type c:\Inetpub\wwwroot\hello.php <?php echo 'Hello World 2 from IIS'; ?>
Sample Perl run:

C:\>fakefcgi.exe c:\Inetpub\wwwroot\hello.plfcgi "C:\Perl\bin\perl.exe c:\inetpub\wwwroot\hello.plfcgi"

Fake FastCGI web server
FCGI_PARAMS sent
FCGI_STDIN sent
Launching receive loop
FCGI_STDOUT: hello world
FCGI_STDOUT: (null)
FCGI_END_REQUEST received
killing app
FastCGI process exited with 0

C:\>type c:\Inetpub\wwwroot\hello.plfcgi
use CGI::Fast qw(:standard);
$COUNTER = 0;
while (new CGI::Fast) {
    print "hello world";
}

As you can see, this is only really useful for the initial development of a Windows FastCGI Named Pipe library. That being said, once in a while it's useful to see a script running from the command line inside FastCGI.

1 Comment

Comments have been disabled for this content.