Run HTTP/2
← Protocols and TLSHTTP/2 lets one TCP connection carry several request streams. Mini4Work negotiates it over TLS and uses libnghttp2 for HPACK header compression.
Install the runtime
Complete the base PHP installation. Install the libnghttp2 runtime for your system. On Debian or Ubuntu use sudo apt-get install libnghttp2-14. On Homebrew use brew install libnghttp2. Check the same PHP binary and curl binary you will use below.
php --ri openssl
php --ri ffi
curl -VPHP needs OpenSSL and the FFI extension. The launch command enables FFI for this CLI invocation. The client should list HTTP2 under Features.
Start with TLS
Save this as http2.json in the application root. It creates development certificates in var/tls. The client will trust the public CA explicitly for its request.
{
"listen": { "port": 9000 },
"protocols": { "http": "2" },
"tls": {
"mode": "local",
"storage": "var/tls",
"local": { "trust_ca": "off" }
}
}php -d ffi.enable=true vendor/mini4work/webserver/examples/server.php http2.jsonVerify negotiation
In another terminal, replace the CA path below with the public certificate path from the server’s tls.trust.root event.
CA=/path/from/tls.trust.root
curl --http2 --cacert "$CA" -sS -o /dev/null \
-w 'HTTP/%{http_version} %{http_code}\n' https://127.0.0.1:9000/Expect HTTP/2 200. If the client reports 1.1, verify that you reached this TLS listener and that intermediaries offer HTTP/2. If startup fails, check FFI and libnghttp2 in the server process. A certificate error calls for the CA issued by this profile and a host covered by the certificate.