Search code examples
fastcgi

How can fastCGI applications be started manually on Windows?


I am have configured a Web Server to use a 'remote' fastCGI application over a named pipe (it's actually on the same windows host). I am now trying to find out how to start the fastCGI application to use this pipe but am unsure how this should be done. Other OS's seem to have spawn-fcgi utilities for doing this but there doesn't seem to be anything similar for Windows.

This is my APP:

#include <stdio.h>
#include "fcgi_stdio.h"

int main(int argc, char ** argv)
{
  while (FCGI_Accept() >= 0) {
    printf("Content-type: text/html\r\n"
        "\r\n"
        "<title>Web Services Interface Module</title>"
        "<h1>Web Services Interface Module</h1>\n");
  }
  return(0);
}

Out of interest I am using Abyss Web Server though I hope that doesn't have a bearing on the answer.

Best Regards


Solution

  • The FCGI interface does not let you do this, instead use the FCGX interface. Call FCGX_Open_Socket to listen on a specific port e.g. 9345 or a named pipe.

    FCGX_OpenSocket(":9345", 500);
    

    Then you don't need to use a utility like spawn_fcgi to start your application at all.