Skip to main content

Talk to PHP-FPM directly.

A PHP client for the FastCGI protocol. Run scripts through PHP-FPM from your own code — one request at a time, in the background, or many in parallel. No web server in between, no dependencies.

composer require hollodotme/fast-cgi-client

31.7M

Downloads in total

58.8K

Downloads on Nov 16

Aug 19 – Nov 16

Numbers from Packagist and GitHub, updated daily

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.

Your PHP scriptusing the FastCGI Clientpreparing the requestPHP-FPMworker #1idlescript.php · sleep(2)
0.0 s
sync.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();
$ php sync.php

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.

Support its maintenance

The FastCGI Client is free and maintained in spare time. If it saves you work, consider sponsoring its maintainer on GitHub.

Holger Woltersdorf

Maintainer since 2016

GitHub Sponsors profile