Protocols and TLS
Choose a protocol
Set protocols.http to a string. The default is "1.1". Explicit selection makes missing dependencies a startup error. With "auto", the server tries HTTP/3, HTTP/2 and then HTTP/1.1 according to the available runtime and TLS configuration.
"1.1"· TCP- Works with plain HTTP or TLS. Plain application requests need only the base PHP extensions. HTTPS uses OpenSSL.
"2"· TLS over TCP- Requires a TLS mode, FFI enabled for the PHP CLI running the server, and libnghttp2 for header compression. Multiple requests can share a connection as separate streams.
"3"· QUIC over UDP- Requires TLS, FFI and a compatible native QUIC backend. The server tries quiche first, then the ngtcp2/nghttp3 adapter. For nonstandard installations, specify the shared library under
protocols.http3.quiche.libraryorprotocols.http3.ngtcp2.library. Both default to discovery.
Publish both UDP and TCP when deploying HTTP/3. The TCP companion lets clients reach the service and discover the QUIC endpoint. protocols.http3.public_port controls the port advertised in Alt-Svc. Its default, null, advertises listen.port. Set the external UDP port here when forwarding uses a different port.
Verify the connection
Save the HTTP/2 or HTTP/3 profile as m4w.json. Start the server and run the matching curl command in a second terminal.
php -d ffi.enable=true vendor/mini4work/webserver/examples/server.php m4w.jsonIn another terminal, replace the CA path below with the public certificate path from the server’s tls.trust.root event.
HTTP/2
CA=/path/from/tls.trust.root
curl --cacert "$CA" --http2 -sS -o /dev/null -w '%{http_version}\n' https://localhost:9000/HTTP/3
CA=/path/from/tls.trust.root
curl --cacert "$CA" --http3-only -sS -o /dev/null -w '%{http_version}\n' https://localhost:9000/Protocol timeouts
protocols.http1.header_timeout_seconds· 1- Time allowed to complete headers once the first request byte arrives.
protocols.http1.request_timeout_seconds· 5- Bounds the initial idle wait and the wait to admit and read a request body.
protocols.http1.connection_lifetime_seconds· 60- Stops new requests from starting on an aging connection. HTTP/1.1 timeouts also apply to the TCP TLS fallback listener.
protocols.http2.flow_control_timeout_seconds· 2- Limits the wait for a peer to grant DATA credit while sending an HTTP/2 response.