Everything the stack did, one process does

Execution model, HTTP delivery, shared state, observability and security are built in, and each part is either on by default or one environment variable away.

Execution model

Workers boot once and stay up. Fibers let each one hold hundreds of requests at a time, and closures can run on threads of their own.

  • Worker mode

    PHP workers bootstrap once and handle thousands of requests. Superglobals, buffers and headers soft-reset between requests; autoloaders, containers and DB connections persist.

  • Fiber multiplexing

    Each worker handles hundreds of concurrent requests via PHP Fibers. Sleeps and awaits yield the fiber instead of blocking the thread, and with runtime hooks so do native sleep(), socket reads, connects, TLS waits and cURL transfers.

  • Async promises

    Dispatch closures to a separate thread pool and await the results. The all, race and any combinators handle parallel fan-out.

  • Early response

    Send the response to the client immediately, then keep processing in the background, for example to queue jobs or write logs.

  • Decorators

    Intercept function and method calls with PHP 8 attributes to retry, cache, trace or guard them without touching call sites.

  • SSE streaming

    Server-Sent Events straight from PHP. oxphp_stream_flush() sends each event the moment you call it, and a slow client gets backpressure instead of a growing buffer.

HTTP & delivery

Routing, static files, TLS, compression and protection, set with environment variables instead of a web-server config.

  • Three routing modes

    Traditional file mapping, framework front-controller, or SPA fallback, switched by one variable. Worker mode stacks on top of any of them.

  • Static files

    In-memory content cache, automatic MIME detection, ETag and Last-Modified headers, streaming for large files.

  • Compression

    Zstandard, Brotli and gzip out of the box, negotiated per client by q-value with a level per codec. Cached static files get a precompressed Brotli copy.

  • Built-in TLS

    TLS termination from two variables (PEM certificate and key), with the minimum protocol version enforced at startup.

  • Rate limiting

    Per-IP limits with configurable windows. Over-limit requests get 429; a full PHP queue answers 529 backpressure.

  • Timeouts

    Header-read timeout against Slowloris, request timeouts, and a graceful drain window on shutdown.

  • Custom error pages

    Your own HTML per status code: drop 404.html or 503.html in a directory and point one variable at it.

  • Graceful shutdown

    SIGTERM drains in-flight connections before exit, so rolling deploys don't drop requests.

Shared state

Process-wide concurrent primitives so workers coordinate without Redis or APCu. In-process operations take microseconds instead of network round-trips.

  • Counter

    Atomic int64 accumulator with get, set, add and compareAndSet.

  • Atomic

    Int64 with explicit memory-ordering control.

  • Flag

    Atomic boolean for one-shot transitions.

  • Once

    Run-once container with reentrancy-safe factory.

  • Mutex

    Poisoning mutex over a stored value, with deadlock detection.

  • Channel

    Bounded, fiber-aware MPMC queue between workers.

  • Map

    Concurrent string-keyed store with batched access.

  • Pool

    Bounded object pool with per-thread affinity.

Observability

Metrics, logs, traces and profiles come from the server itself, with no exporter to run and no code to change.

  • Prometheus metrics

    A separate internal port exposes request, worker, queue, cache and async metrics for Prometheus to scrape.

  • Structured logging

    JSON access logs with method, path, status, duration and request ID in every line. Loki and Elasticsearch parse them as-is.

  • Request IDs

    X-Request-ID generated or passed through automatically, available in PHP and stamped on every log line.

  • Tracing & APM

    W3C Trace Context, OpenTelemetry export, auto-instrumentation of PDO, cURL and Redis, plus a PHP tracing SDK.

  • Built-in profiler

    Per-request profiles in xhprof and collapsed-stack (FlameGraph) formats, triggered by a header or by sampling.

  • Health checks

    Liveness and readiness endpoints plus a live configuration snapshot. Kubernetes probes work out of the box.

Security

Hidden files and symlink escapes are blocked by default, and deny-lists cover the sharp edges of legacy PHP apps.

  • Dot-path blocking

    Hidden files and directories (.env, .git/, .htaccess) are never served. It's on by default.

  • Trusted proxies

    Real client IP from Forwarded (RFC 7239), X-Forwarded-* and, behind Cloudflare, CF-Connecting-IP. Trust is given as CIDRs and keywords like private and cloudflare, and the address is resolved rightmost-non-trusted.

  • PHP execution deny-list

    Block .php execution at writable paths like /uploads/**, so uploaded-shell attacks on legacy apps die before disk I/O.

  • Symlink allow-paths

    Symlink escapes from the document root are blocked unless explicitly allow-listed. Laravel storage:link still works.

  • Path deny rules

    A .gitignore-style .oxphpdeny keeps vendor/, SQL dumps and backups from being served. It covers static files and PHP alike, in every routing mode, and is checked before any disk access.