Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

FcgiBlockingTransport
in package
implements FcgiTransport

FinalYes

Blocking FastCGI transport (#289) — plain stream_socket_client + blocking fread/fwrite.

Used when the dispatch runs OUTSIDE a coroutine (Coroutine::getCid() < 0) — the legacy-cgi / superglobals(true) lifecycles, where the OpenSwoole worker handles one request at a time synchronously and the request handler is NOT coroutine-wrapped. A blocking socket has no coroutine scheduler to deadlock, which is the correct behaviour there: it replaces #261's nested Coroutine::run() that hung every request (#289).

Outside a coroutine, OpenSwoole's runtime hooks are inactive, so these fread/fwrite calls are ordinary blocking syscalls — no event loop involved. The socket timeout (stream_set_timeout) bounds a wedged backend so a stuck php-fpm can't pin the worker forever.

Table of Contents

Interfaces

FcgiTransport
Socket transport for {@see FastCgiClient} (#289).

Properties

$host  : string
$isUnix  : bool
$port  : int
$sock  : resource|null
$timeout  : float

Methods

__construct()  : mixed
close()  : void
Close the connection (idempotent).
connect()  : void
Open the connection to the FastCGI backend.
recv()  : string
Receive up to $maxLen bytes. Returns '' on a clean EOF (peer closed).
send()  : void
Send all bytes to the backend.

Properties

Methods

__construct()

public __construct(string $host, int $port, bool $isUnix, float $timeout) : mixed
Parameters
$host : string
$port : int
$isUnix : bool
$timeout : float

recv()

Receive up to $maxLen bytes. Returns '' on a clean EOF (peer closed).

public recv(int $maxLen) : string
Parameters
$maxLen : int
Return values
string

send()

Send all bytes to the backend.

public send(string $data) : void
Parameters
$data : string
On this page