lighttpd/moinmoin/fastcgi: child exited with status 127

Rainer Schwarze rsc at
Thu Aug 11 20:30:52 UTC 2011

On 8/11/2011 7:35 PM, Olivier Duchateau wrote:
> Hi,
> MoinMoin wiki is written in Python, so lighttpd must be configured
> either wscgi (fastcgi) or cgi.


fastcgi is activated and does work.

I spent some more time on that and looked into the sources and inserted
some debug output statements (error.log and code snippet below). I'd say
that during manual start 6 child processes are started, during jail
startup only 1 is started. The line "xxx child 4" is written just before
the call to execve which starts the cgi. The line "xxx child 5" does not
appear - it would, if execve would return - so that seems ok.

The lines "child 6" and "child 7" are written before the call to
waitpid. They appear only once, so I guess, the first child fails. (in
contrast to a second child causing errors)

My next steps will be to look into the moin.fcgi script and try to add
some debugging statements. I'd assume that this goes belly up at some
point. However, maybe in a few hours - for now I have to get back to the
work which pays my bills :-)

Does this provide some hints where my problem could be?

Thanks and best regards,

The error.log:

( -------- when jail starts: ------------)
2011-08-11 19:55:35: (log.c.166) server started
2011-08-11 19:55:35: (mod_fastcgi.c.1098) xxx child 6
2011-08-11 19:55:35: (mod_fastcgi.c.1007) xxx child 1
2011-08-11 19:55:35: (mod_fastcgi.c.1015) xxx child 2
2011-08-11 19:55:35: (mod_fastcgi.c.1076) xxx child 3
2011-08-11 19:55:35: (mod_fastcgi.c.1079) xxx child 4
2011-08-11 19:55:35: (mod_fastcgi.c.1101) xxx child 7
2011-08-11 19:55:35: (mod_fastcgi.c.1114) the fastcgi-backend
/usr/local/www/wiki/admadic/moin.fcgi failed to start:
2011-08-11 19:55:35: (mod_fastcgi.c.1118) child exited with status 127
2011-08-11 19:55:35: (mod_fastcgi.c.1121) If you're trying to run your
app as a FastCGI backend, make sure you're using the FastCGI-enabled
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2011-08-11 19:55:35: (mod_fastcgi.c.1409) [ERROR]: spawning fcgi failed.

The source snippet from mod_fastcgi.c:

/* father */
/* wait */
log_error_write(srv, __FILE__, __LINE__, "s", "xxx child 6");
select(0, NULL, NULL, NULL, &tv);
log_error_write(srv, __FILE__, __LINE__, "s", "xxx child 7");
switch (waitpid(child, &status, WNOHANG)) {
case 0:
  /* child still running after timeout, good */
  log_error_write(srv, __FILE__, __LINE__, "s", "xxx child 8");
case -1:
  /* no PID found ? should never happen */
  log_error_write(srv, __FILE__, __LINE__, "ss", "pid not found:",
  return -1;
  log_error_write(srv, __FILE__, __LINE__, "sbs",
    "the fastcgi-backend", host->bin_path, "failed to start:");
  /* the child should not terminate at all */
  if (WIFEXITED(status)) {
    log_error_write(srv, __FILE__, __LINE__, "sdb",
      "child exited with status",
      WEXITSTATUS(status), host->bin_path);
    log_error_write(srv, __FILE__, __LINE__, "s",
      "If you're trying to run your app as a FastCGI backend, make sure
you're using the FastCGI-
enabled version.\n"
      "If this is PHP on Gentoo, add 'fastcgi' to the USE flags.");

thanks and best regards,

> 2011/8/11 Rainer Schwarze <rsc at>:
>> On 8/11/2011 3:31 AM, Sahil Tandon wrote:
>>> On Wed, 2011-08-10 at 23:27:25 +0200, Rainer Schwarze wrote:
>>>> I want to run a moinmoin wiki in a jail via lighttpd. When I start the
>>>> jail, lighttpd logs an error and stops. When I run it manually, it
>>>> starts without problems and I can access the wiki in the browser.
>>>> It looks like there are certain differences between starting when the
>>>> jail starts and starting manually. Which of those would influence this
>>>> issue? Can you give me any hints where I should start looking? (I asked
>>>> google but didn't get useful results.)
>>> What is the output of the following command, inside the jail, as the
>>> user that runs lighttpd?
>>>  % php-cgi -v
>> srvks# php-cgi -v
>> php-cgi: Command not found.
>> :-) php is not needed there (at least I hope so).
>>>> 2011-08-10 20:54:54: (mod_fastcgi.c.1108) child exited with status 127
>>>> /usr/local/www/wiki/admadic/moin.fcgi
>>> Without more information, my WAG is that certain files (libraries,
>>> perhaps) used by fcgi cannot be found by lighttpd from inside the jail.
>> The confusing part is, I can start it in the jail manually with
>> /usr/local/etc/rc.d/lighttpd start
>> So all the required things should be there.
>> Are there any debug flags which I could activate to get more output from
>> lighttpd? I probably don't need those which log requests etc. There
>> don't seem to be any as command line parameter?
>> best regards,
>> Rainer
>> --
>> Rainer SCHWARZE (Mr.)
>> _______________________________________________
>> freebsd-ports at mailing list
>> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at"

Rainer SCHWARZE (Mr.)

More information about the freebsd-ports mailing list