Expand description
FastCGI client: PHP through php-fpm (18.21.0). FastCGI (18.21.0, #72): PHP through php-fpm, and any other FastCGI responder, without FrankenPHP or a second web server.
FastCgi is an Application: it maps a request onto a script under
its root the way nginx’s and Caddy’s PHP setups do, sends it to the
FastCGI server over TCP or a Unix socket, and turns the CGI response
(RFC 3875 §6) back into a Response. Connections are kept alive and
pooled. The config file’s type = "fastcgi" action builds one.
Which script runs for a request path P (with split_path = ".php"):
Pnames a file under the root that isn’t a script → served as a static file (when a static handler is attached).Pis a directory with an index script (index.php) → that script (/dirwithout the slash gets a redirect to/dir/).Pcontains.phpand the part up to it is a script file → that script, the rest isPATH_INFO(/index.php/users/7).- Otherwise the front controller (
/index.php, the Laravel / Symfony / WordPress pattern), withREQUEST_URIunchanged.
A script must be a regular file under the root whose path ends in the
split extension and has no dot-file segment, so /uploads/x.jpg/a.php
never runs x.jpg (the old cgi.fix_pathinfo hole).
Structs§
- FastCgi
- FastCGI as an
Application. See the module docs. - Fast
CgiConfig - Settings of a
FastCgihandler. - Record
- One record: type, request id and content.
Enums§
- Address
- Where the FastCGI server listens.
Functions§
- decode_
params - Decode name-value pairs;
Noneon truncated or oversized input. - encode_
params - Name-value pairs (§3.4): lengths < 128 in one byte, others in four with the top bit set.
- encode_
record - Append a record (content ≤ 65535 bytes) to
out, padded to 8 bytes. - encode_
stream - Append a stream (PARAMS, STDIN) as records, then its empty terminator.
- params_
from_ map - Parse the FastCGI routes’
paramstable into pairs (for the config file). - parse_
cgi_ headers - Status, reason and headers of a CGI response header block.
Status:sets the status; aLocation:without one is a302. - parse_
records - Parse a buffer of records completely (for the fuzzer and tests):
Noneon a malformed record. - read_
record - Read one record;
Ok(None)at a clean end of stream.