Manual: cgi-fcgi
NAME
cgiâfcgi â bridge from CGI to FastCGI
SYNOPSIS
cgiâfcgi âf cmdPath
cgiâfcgi âbind âconnect connName
cgiâfcgi âstart âconnect connName appPath [nServers]
cgiâfcgi âconnect connName appPath [nServers]
DESCRIPTION
cgiâfcgi is a CGI/1.1 program that communicates with an
alreadyârunning FastCGI application in order to respond to
an
HTTP request. cgiâfcgi is also capable of starting a
FastCGI
application.
When you invoke cgiâfcgi as
cgiâfcgi âf cmdPath
then cgiâfcgi opens the file at cmdPath and reads its
arguments from that file. cgiâfcgi will skip lines
that begin with the comment character #. The first
nonâcomment line should contain valid arguments in
one of the other three forms.
The âf form of cgiâfcgi is designed for Unix systems
whose exec(2) family of system calls supports the execution
of
command interpreter files. For instance, if a file with
execute permission contains the text
#! /bin/cgiâfcgi âf
âconnect /httpd/root/sock/app /httpd/root/bin/app
the effect is the same as executing
/bin/cgiâfcgi âconnect /httpd/root/sock/app
/httpd/root/bin/app
When you invoke cgiâfcgi as
cgiâfcgi âbind âconnect connName
the connName argument is either the path name of a Unix doâ
main
listening socket or a host:port pair. If connName contains
a colon, it is assumed to be host:port. cgiâfcgi performs
a connect(2) using connName. If the connect succeeds, cgiâ
fcgi
forwards the CGI environment variables and stdin data to the
FastCGI application, and forwards the stdout and stderr data
from
the application to cgiâfcgiâs stdout (most likely connected
to
a Web server). When the FastCGI application signals the end
of
its response, cgiâfcgi flushes its buffers and
exits, and the Web server completes the http response.
When you invoke cgiâfcgi as
cgiâfcgi âstart âconnect connName appPath [nServers]
then cgiâfcgi performs the function of starting one or more
FastCGI application processes. The connName argument speciâ
fies
either the path name of the Unix domain listening socket
that
cgiâfcgi will create, or is "localhost:NNN" where NNN is the
port
number of the TCP/IP listening socket that cgiâfcgi will
create
on the local machine. (cgiâfcgi will not create processes
on remote machines.) After cgiâfcgi creates the listening
socket,
it forks nServers copies of a process running the executable
file
appPath. If nServers is omitted, the effect is as if the
value "1"
had been specified. The processes share the single listenâ
ing socket.
When you invoke cgiâfcgi as
cgiâfcgi âconnect connName appPath [nServers]
cgiâfcgi performs âbind and then, if necssary, performs
âstart
and repeats the âbind. That is, cgiâfcgi first operates as
if
the command had been
cgiâfcgi âbind âconnect connName
If the connect fails, cgiâfcgi tries
cgiâfcgi âstart âconnect connName appPath [nServers]
and finally retries
cgiâfcgi âbind âconnect connName
In this form, cgiâfcgi does not support TCP/IP connections.
ENVIRONMENT VARIABLES
The usual CGI ones, but they are not interpreted by cgiâ
fcgi.
SEE ALSO
FGCI_accept(3)
BUGS
cgiâfcgi doesnât generate useful HTTP responses in case of
error,
and it generates no response at all when run as startâfcgi.
On Digital UNIX 3.0 systems the implementation of Unix Doâ
main
sockets does not work when such sockets are stored on NFS
file
systems. Symptom: cgiâfcgi may core dump or may exit with
status 38. Workâaround: store sockets in local file systems
(/tmp often works) or use TCP/IP.
On AIX systems the implementation of listening sockets
does not support socket sharing, and the standard FastCGI
application libraries canât synchronize access to AIX lisâ
tening
sockets. Workâaround: Donât use the nServers argument on
AIX.
HISTORY
Copyright (c) 1996 Open Market, Inc.
See the file "LICENSE" for information on usage and redisâ
tribution
of this file, and for a DISCLAIMER OF ALL WARRANTIES.
$Id: cgiâfcgi.1,v 1.1.1.1 1997/09/16 15:36:26 stanleyg Exp $