I am trying to get started with fastcgi development, therefor I download the reference implementation of libfcgi
and tried to get a testprogram to run with lighttpd
. Since fcgi_stdio
allows for cgi
backwards compatibility, I decided to start with that.
However I could not get the examples/tiny-fcgi.c
to work with lighttpd
, it yielded an internal server errror 500
, the same configuration allows to run the lighttpd
example program (http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI, below C/C++ FastCGI on lightty named socket
) flawless. However it is totally unclear to me why the default supplied example would not work.
Questions:
I have tested the unmodified example (Ubuntu/13.10/amd-64, Apache/2.4.6, libapache2-mod-fastcgi/2.4.7~0910052141-1.1, libfcgi-dev/2.4.0-8.1ubuntu4) and it runs ok:
manuelz@garibaldi:~$ curl habrich/tiny-fcgi
<title>FastCGI Hello! (C, fcgi_stdio library)</title>
<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>
Request number 2 running on host <i>habrich</i>
Answers:
getenv
will return NULL
if SERVER_NAME
is undefined.fcgiapp
is the base implementation: I would use that one for new development. fcgi_stdio
is a wrapper for compatibility with CGI: use that for migrating legacy CGI projects. Quote:
fcgi_stdio is implemented as a thin layer on top of fcgiapp
fcgiapp
in the fcgiapp.h header.