1NAME
2 cgi‐fcgi ‐ bridge from CGI to FastCGI
3
4SYNOPSIS
5 cgi‐fcgi ‐f cmdPath
6 cgi‐fcgi ‐bind ‐connect connName
7 cgi‐fcgi ‐start ‐connect connName appPath [nServers]
8 cgi‐fcgi ‐connect connName appPath [nServers]
9
10DESCRIPTION
11 cgi‐fcgi is a CGI/1.1 program that communicates with an
12 already‐running FastCGI application in order to respond to
13an
14 HTTP request. cgi‐fcgi is also capable of starting a FastC‐
15GI
16 application.
17
18 When you invoke cgi‐fcgi as
19
20 cgi‐fcgi ‐f cmdPath
21
22 then cgi‐fcgi opens the file at cmdPath and reads its
23 arguments from that file. cgi‐fcgi will skip lines
24 that begin with the comment character #. The first
25 non‐comment line should contain valid arguments in
26 one of the other three forms.
27
28 The ‐f form of cgi‐fcgi is designed for Unix systems
29 whose exec(2) family of system calls supports the execution
30of
31 command interpreter files. For instance, if a file with
32 execute permission contains the text
33
34 #! /bin/cgi‐fcgi ‐f
35 ‐connect /httpd/root/sock/app /httpd/root/bin/app
36
37 the effect is the same as executing
38
39 /bin/cgi‐fcgi ‐connect /httpd/root/sock/app
40/httpd/root/bin/app
41
42 When you invoke cgi‐fcgi as
43
44 cgi‐fcgi ‐bind ‐connect connName
45
46 the connName argument is either the path name of a Unix do‐
47main
48 listening socket or a host:port pair. If connName contains
49 a colon, it is assumed to be host:port. cgi‐fcgi performs
50 a connect(2) using connName. If the connect succeeds, cgi‐
51fcgi
52 forwards the CGI environment variables and stdin data to the
53 FastCGI application, and forwards the stdout and stderr data
54from
55 the application to cgi‐fcgi’s stdout (most likely connected
56to
57 a Web server). When the FastCGI application signals the end
58of
59 its response, cgi‐fcgi flushes its buffers and
60 exits, and the Web server completes the http response.
61
62 When you invoke cgi‐fcgi as
63
64 cgi‐fcgi ‐start ‐connect connName appPath [nServers]
65
66 then cgi‐fcgi performs the function of starting one or more
67 FastCGI application processes. The connName argument speci‐
68fies
69 either the path name of the Unix domain listening socket
70that
71 cgi‐fcgi will create, or is "localhost:NNN" where NNN is the
72port
73 number of the TCP/IP listening socket that cgi‐fcgi will
74create
75 on the local machine. (cgi‐fcgi will not create processes
76 on remote machines.) After cgi‐fcgi creates the listening
77socket,
78 it forks nServers copies of a process running the executable
79file
80 appPath. If nServers is omitted, the effect is as if the
81value "1"
82 had been specified. The processes share the single listen‐
83ing socket.
84
85 When you invoke cgi‐fcgi as
86
87 cgi‐fcgi ‐connect connName appPath [nServers]
88
89 cgi‐fcgi performs ‐bind and then, if necssary, performs
90‐start
91 and repeats the ‐bind. That is, cgi‐fcgi first operates as
92if
93 the command had been
94
95 cgi‐fcgi ‐bind ‐connect connName
96
97 If the connect fails, cgi‐fcgi tries
98
99 cgi‐fcgi ‐start ‐connect connName appPath [nServers]
100
101 and finally retries
102
103 cgi‐fcgi ‐bind ‐connect connName
104
105 In this form, cgi‐fcgi does not support TCP/IP connections.
106
107ENVIRONMENT VARIABLES
108 The usual CGI ones, but they are not interpreted by cgi‐fc‐
109gi.
110
111SEE ALSO
112 FGCI_accept(3)
113
114BUGS
115 cgi‐fcgi doesn’t generate useful HTTP responses in case of
116error,
117 and it generates no response at all when run as start‐fcgi.
118
119 On Digital UNIX 3.0 systems the implementation of Unix Do‐
120main
121 sockets does not work when such sockets are stored on NFS
122file
123 systems. Symptom: cgi‐fcgi may core dump or may exit with
124 status 38. Work‐around: store sockets in local file systems
125 (/tmp often works) or use TCP/IP.
126
127 On AIX systems the implementation of listening sockets
128 does not support socket sharing, and the standard FastCGI
129 application libraries can’t synchronize access to AIX lis‐
130tening
131 sockets. Work‐around: Don’t use the nServers argument on
132AIX.
133
134HISTORY
135 Copyright (c) 1996 Open Market, Inc.
136 See the file "LICENSE.TERMS" for information on usage and
137redistribution
138 of this file, and for a DISCLAIMER OF ALL WARRANTIES.
139 $Id: cgi‐fcgi.1,v 1.1.1.1 1997/09/16 15:36:26 stanleyg Exp $
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198