Run HTTP/1.1

← Protocols and TLS

Use HTTP/1.1 for a first local run or a TCP backend behind a reverse proxy. The default listener uses plain HTTP on 127.0.0.1:8080.

Check PHP

Use PHP CLI 8.3 or a later 8.x release on a supported Unix system. Install the package in your application directory. Composer checks for the required pcntl, posix and sockets extensions.

Shell
php -v
composer require mini4work/webserver

Start the listener

Shell
php vendor/mini4work/webserver/examples/server.php

The bundled handler prints request details as JSON. Plain HTTP/1.1 works without FFI. To change the port, follow Apply a profile. For HTTPS with HTTP/1.1, keep protocols.http at "1.1" and configure a certificate mode.

Send a request

Shell
curl --http1.1 -i http://127.0.0.1:8080/hello

Expect HTTP/1.1 200 and a JSON body containing "path": "/hello". If the connection is refused, check the startup output for a port conflict and confirm the address. A remote client needs a reachable listener address or a proxy. Press Ctrl+C in the server terminal to stop it.