[FASTCGI] fastcgiapp socket creation

baerni at bluewin.ch baerni at bluewin.ch
Fri Oct 15 05:22:24 EDT 2010


I am writing a web app in C, using lighttpd and the fcgiapp library. A first sample is working now, based on the 
echo2.c examle.
Since I had some troubles to make the setup work, I would like to ask some questions get a better 
understanding of seting up and
starting a fastCGI application with lighttpd (mod_fcgi):

1. On your website I found a 
link poining to a manual on the lighttpd page. It contains a configuration and c program example.
   The c program is 
using the funtion FCGX_Accept_r. When I started the lighttd server I figured out that the server starts the
application as many times as the number of processes configured in the lighttpd config file and creates a socket for
each process, ending with -0 ... -n. Unfortunately the sample c program does not create any socket and therefore does 
   listen to anything. I was able to make it work with a one process configuration and creation of a hard coded 
socket with
   the same name as the one of the lighttpd server (test.fcgi.socket-0). Since the lighttpd server does not 
pass any arguments
   to the fcgi application about socket locations and names, I wonder how this must be set up to 
work properly.

2. My current setup is made based on the echo2.c example mentioned in the documentation of your 
development kit. Unfortunately
   the source file is not available in your development kit and I had to get it from 
somewhere else on the web. The setup was working
   without any problem. The only thing I wonder is how the application 
figures out on which socket it should listen, since it just
   waits on the accept function. I would apreciate if you 
may let me know more details about the "magic" of how the application
   knows where the socket of the webserver is, 
since the socket is created by the webserver and the fcgi application is started
   by the webserver without passing 
any arguments.

Kind regards


More information about the FastCGI-developers mailing list