HTTP/2 is entirely outside the scope of the PHP web SAPI as it currently
exists. The protocol impacts the actual HTTP server and has nothing to do
with the SAPI runtime which is simply handed information about the HTTP
request once the server parses it. The protocol used to communicate those
details between the client and the HTTP server does not concern the web
SAPI. There is no need for any sort of "support for h2" in PHP; it's the
web server's concern. Apache and nginx will add support for h2 and PHP will
continue working as it always has.

That said, the php web SAPI derives exceedingly little benefit from the
advent of HTTP/2.0. h2 is designed to allow multiplexing of many requests
over the same TCP connection but the PHP web SAPI still has the same
bottleneck it had before h2: one thread/process per request.

As for websockets, you *can* do that using the web SAPI right now if you
wished but this would be inadvisable because long-lived connections will
quickly fill the bottleneck in every PHP web application (concurrent
threads/processes for each "request").

Instead, the appropriate solution for websockets would be to implement a
socket server directly in the CLI that speaks the websocket protocol.

Would it be useful to have raw incremental parsing functionality for
HTTP/1.1, HTTP/1.2 and websocket protocols available in userland? Sure, but
this falls more in the realm of an extension than anything else as few
people are implementing full-blown http and websocket servers in the CLI
right now.

Reply via email to