Three ways to send a request
Press play, step through, or let it run: the animations show what your script, the socket and PHP-FPM do.
sendRequest() sends the request and returns the response, like calling a function — only that the code runs in PHP-FPM. Read the docs
1/6Create the client, a connection to PHP-FPM and a request for script.php.
$client = new Client();
$connection = new NetworkSocket('127.0.0.1', 9000);
$request = new PostRequest(
'/path/to/target/script.php',
new UrlEncodedFormData(['key' => 'value', 'sleep' => 2])
);
$response = $client->sendRequest($connection, $request);
echo $response->getBody();
Tested against real FastCGI servers
Every change runs the test suite against PHP-FPM and against FastCGI servers written in other languages, so the client sticks to the protocol, not to the quirks of one server.
Latest results from November 6, 2026.
Built by 15 people
The library started as a port of Pierrick Charron's PHP-FastCGI-Client and grew with every pull request. Want to be next? Read the contribution guide.
Holger WoltersdorfMaintainer
Pierrick CharronOriginal author
Yvan Taviaud1 commit
Evan Zacks1 commit
Mohamed Said1 commit
Markus1 commit
Jacob Dreesen1 commit
Ryan BrothersContributor
Arne BlankertsContributor
Andy BuckinghamContributor
Matthieu Napoli1 commit
Menno Holtkamp1 commit
Daniel Schmelz1 commit
Sander De la MarcheContributor
Rainer M. CanavanContributor
Support its maintenance
The FastCGI Client is free and maintained in spare time. If it saves you work, consider sponsoring its maintainer on GitHub.
