title: How to configure and run a fastcgi application using Lighthttpd
body: <p>i've installed Lighthttpd for windows and i'd created a simple program in c++ which uses fastcgi libraries. i'll post the code here...</p>
  
  <pre><code>#include "fcgi_stdio.h" 
  #include &lt;stdlib.h&gt;
  int count;
  void initialize(void)
  {
    count=0;
  }
  void main(void)
  {
    initialize();
    while (FCGI_Accept() &gt;= 0)   {
      printf("Content-type: text/html\r\n"
             "\r\n"
             "&lt;title&gt;FastCGI Hello! (C, fcgi_stdio library)&lt;/title&gt;"
             "&lt;h1&gt;FastCGI Hello! (C, fcgi_stdio library)&lt;/h1&gt;"
             "Request number %d running on host &lt;i&gt;%s&lt;/i&gt;\n",
              ++count, getenv("SERVER_HOSTNAME"));
    }
  }
  </code></pre>
  
  <p>I've spawned the fastcgi application in lighthttpd using the below configuration in lightttpd-inc.conf</p>
  
  <pre><code>fastcgi.server             = ( ".exe" =&gt;
                                 ( "" =&gt; 
                                   (
                                     "bin-path" =&gt; "D:\tinycgi.exe",
                                     "port" =&gt; 8080,
                                     "min-procs" =&gt; 1,
                                     "max-procs" =&gt; 1
                                   )
                                 )
                               )
  </code></pre>
  
  <p>while sending a request using the browser the server is responding with this message in the console </p>
  
  <pre><code>2009-02-18 16:08:34: (mod_fastcgi.c.2494) unexpected end-of-file (perhaps the fa
  stcgi process died): pid: 0 socket: tcp:localhost:8080
  2009-02-18 16:08:34: (mod_fastcgi.c.3325) response not received, request sent: 1
  024 on socket: tcp:localhost:8080 for /new/tinycgi.exe , closing connection
  </code></pre>
  
  <p>I think the fastcgi application is not spawned correctly.</p>
  
  <p>Thank you,
  Varun    </p>