# OxPHP

> Asynchronous, multi-threaded PHP application server written in Rust. One binary replaces nginx + PHP-FPM, with TLS, compression, rate limiting, metrics, tracing and profiling built in.

## Pages

- [OxPHP — PHP application server in Rust](https://oxphp.dev/en/index.md): OxPHP is a multithreaded PHP application server written in Rust. One process replaces nginx and PHP-FPM — TLS, metrics, tracing and a built-in profiler, for legacy and modern PHP alike.
- [Features](https://oxphp.dev/en/features.md): Worker mode, fiber multiplexing, async promises, shared state, Prometheus metrics and a built-in profiler — the nginx + PHP-FPM stack's job, in one process.
- [Configuration](https://oxphp.dev/en/configuration.md): Every OxPHP setting is an environment variable. Full reference: TLS, compression, rate limiting, workers, metrics, logging and health checks, with defaults.
- [Examples](https://oxphp.dev/en/examples.md): Laravel, Symfony, WordPress, Drupal, Magento and more on OxPHP, each verified end-to-end: a complete Docker Compose project you can copy and run as it is.
- [Changelog](https://oxphp.dev/en/changelog.md): Every notable change to the OxPHP server, its PHP API and the published images — curated highlights per release, newest first, from 0.1.0 to today.

## Docs

- [Architecture Overview](https://oxphp.dev/en/docs/architecture/overview.md): How OxPHP works: async HTTP handling, PHP worker pool, request flow, worker mode, and built-in safety guarantees, from a user's perspective.
- [Craft CMS on OxPHP](https://oxphp.dev/en/docs/examples/cms/craft.md): Run Craft CMS 5 on OxPHP in framework routing mode with MySQL — Dockerfile, Compose file, console-driven install, and OxPHP-specific notes.
- [Drupal on OxPHP](https://oxphp.dev/en/docs/examples/cms/drupal.md): Run Drupal 11 on OxPHP in framework routing mode with MySQL and drush — Dockerfile, Compose file, install steps, and OxPHP-specific notes.
- [October CMS on OxPHP](https://oxphp.dev/en/docs/examples/cms/october.md): Run October CMS 4 on OxPHP in framework routing mode with a public/ mirror and SYMLINK_ALLOW_PATHS, including the Dockerfile, Compose file, install steps, and OxPHP-specific notes.
- [WordPress on OxPHP](https://oxphp.dev/en/docs/examples/cms/wordpress.md): Run WordPress on OxPHP in traditional routing mode with MySQL and a WP-CLI sidecar: a Dockerfile that extends the OxPHP runtime, a Compose file, and OxPHP-specific notes.
- [Magento on OxPHP](https://oxphp.dev/en/docs/examples/ecommerce/magento.md): Run Magento Open Source 2.4 on OxPHP in framework routing mode with MySQL and OpenSearch, including the Dockerfile, Compose file, install steps, the static-asset version symlink, and OxPHP-specific notes.
- [OpenCart on OxPHP](https://oxphp.dev/en/docs/examples/ecommerce/opencart.md): Run OpenCart 4 on OxPHP in traditional routing mode with MySQL and PHP_DENY_PATHS — Dockerfile, Compose file, CLI install, and OxPHP-specific notes.
- [Laravel on OxPHP](https://oxphp.dev/en/docs/examples/framework/laravel.md): Run a Laravel application on OxPHP in framework routing mode with a MySQL database, including the Dockerfile, Compose file, install steps, and OxPHP-specific configuration.
- [Symfony on OxPHP](https://oxphp.dev/en/docs/examples/framework/symfony.md): Run a Symfony application on OxPHP in framework routing mode with no database — Dockerfile, Compose file, install steps, and OxPHP-specific notes.
- [Yii3 on OxPHP](https://oxphp.dev/en/docs/examples/framework/yii3.md): Run a Yii3 (yiisoft/app) application on OxPHP in framework routing mode with no database, the leanest example, with its Dockerfile, Compose file, and OxPHP-specific notes.
- [Example Deployments](https://oxphp.dev/en/docs/examples/overview.md): Real-world recipes for running popular PHP frameworks and CMSs on OxPHP — Laravel, Symfony, Yii3, WordPress, Drupal, Craft, Magento, OpenCart, and October CMS — each with a Dockerfile, Compose file, install steps, and the OxPHP-specific notes that matter.
- [Access Logging](https://oxphp.dev/en/docs/features/access-logging.md): Structured JSON access logs for every HTTP request in OxPHP, with configurable modes for all requests or errors only.
- [Async Promises](https://oxphp.dev/en/docs/features/async-promises.md): Run PHP closures in background threads and await results without blocking the worker pool.
- [Compression](https://oxphp.dev/en/docs/features/compression.md): OxPHP compresses responses with Brotli by default, reducing transfer sizes for text, JSON, SVG, and other compressible content types.
- [Decorators](https://oxphp.dev/en/docs/features/decorators.md): Intercept PHP function and method calls with attribute-based decorators for logging, timing, caching, and access control.
- [Distributed Tracing & APM](https://oxphp.dev/en/docs/features/distributed-tracing.md): W3C Trace Context propagation, OpenTelemetry integration, automatic instrumentation, PHP tracing SDK, and end-to-end observability with OxPHP.
- [Early Response](https://oxphp.dev/en/docs/features/early-response.md): Send the HTTP response immediately with oxphp_finish_request() and continue running background tasks in OxPHP.
- [Custom Error Pages](https://oxphp.dev/en/docs/features/error-pages.md): Serve branded HTML error pages for 4xx and 5xx responses in OxPHP, loaded once at startup and served from memory.
- [Fiber Multiplexing](https://oxphp.dev/en/docs/features/fiber-multiplexing.md): Handle hundreds of concurrent requests on a single PHP worker thread using cooperative multitasking with fibers.
- [Internal Server](https://oxphp.dev/en/docs/features/internal-server.md): A dedicated HTTP server for health checks, Prometheus metrics, live configuration, and plugin endpoints.
- [Profiling PHP code](https://oxphp.dev/en/docs/features/profiling.md): OxPHP's built-in per-request profiler — activation triggers, the PHP SDK and attributes, export formats, internal routes, and production profiling workflows.
- [Rate Limiting](https://oxphp.dev/en/docs/features/rate-limiting.md): Built-in per-IP rate limiting for OxPHP with configurable thresholds, time windows, and standard HTTP rate limit response headers.
- [Request IDs](https://oxphp.dev/en/docs/features/request-ids.md): Automatic unique request identifiers in OxPHP for distributed tracing and log correlation across your stack.
- [Routing](https://oxphp.dev/en/docs/features/routing.md): Configure OxPHP routing with three modes — traditional file mapping, framework front-controller, and SPA fallback — each mirroring the equivalent nginx try_files directive.
- [Server-Sent Events (SSE)](https://oxphp.dev/en/docs/features/sse.md): Stream real-time data to browser clients using Server-Sent Events in OxPHP with built-in backpressure and connection management.
- [Static Files](https://oxphp.dev/en/docs/features/static-files.md): OxPHP serves static files with automatic MIME detection, in-memory caching, HTTP cache headers, conditional 304 responses, and Range requests.
- [Timeouts](https://oxphp.dev/en/docs/features/timeouts.md): Configure header read timeouts and PHP execution timeouts in OxPHP to protect against slow clients and runaway PHP scripts.
- [TLS](https://oxphp.dev/en/docs/features/tls.md): Configure native TLS termination in OxPHP with support for TLS 1.2, TLS 1.3, a configurable minimum protocol version, HTTP/2 ALPN negotiation, and PEM certificates.
- [Worker Mode](https://oxphp.dev/en/docs/features/worker-mode.md): Persistent PHP processes that bootstrap once and handle multiple requests, eliminating per-request startup overhead in OxPHP.
- [Command-Line Interface](https://oxphp.dev/en/docs/getting-started/cli.md): The oxphp binary command grammar: serve the HTTP server, run a single PHP script under CLI semantics, validate configuration, and drop privileges with --user.
- [Docker Guide](https://oxphp.dev/en/docs/getting-started/docker.md): Run OxPHP with Docker, from a minimal image to a multi-stage build, with Compose configuration, PHP ini mounts, health checks, and a port reference.
- [Installation](https://oxphp.dev/en/docs/getting-started/installation.md): Install OxPHP via Docker image or build from source, with notes on prerequisites, verification, and platforms.
- [Link Demo](https://oxphp.dev/en/docs/getting-started/link-demo.md): Demonstrates markdown link rewriting alongside illustrative code samples.
- [Quick Start](https://oxphp.dev/en/docs/getting-started/quick-start.md): Get OxPHP running in under five minutes, from an empty directory to your first request.
- [OxPHP Documentation](https://oxphp.dev/en/docs/index.md): Documentation for OxPHP, a high-performance multithreaded PHP application server with built-in TLS, compression, rate limiting, metrics, SSE streaming, and worker mode.
- [Configuration Reference](https://oxphp.dev/en/docs/operations/configuration.md): Complete environment variable reference for OxPHP, covering every setting, its default, and what it controls.
- [Graceful Shutdown](https://oxphp.dev/en/docs/operations/graceful-shutdown.md): How OxPHP handles SIGTERM and SIGINT signals to drain connections and shut down cleanly, with Kubernetes and Docker configuration examples.
- [Health Checks](https://oxphp.dev/en/docs/operations/health-checks.md): Internal server endpoints for health monitoring, Kubernetes probes, Prometheus metrics, and runtime configuration inspection.
- [Prometheus Metrics](https://oxphp.dev/en/docs/operations/metrics.md): Reference for all Prometheus-compatible metrics exposed by OxPHP at the /metrics endpoint, including request, connection, worker, and compression metrics.
- [PHP Functions](https://oxphp.dev/en/docs/php/functions.md): Complete reference for all oxphp_* PHP functions provided by OxPHP, including async, streaming, worker mode, and decorator APIs.
- [OPcache and JIT](https://oxphp.dev/en/docs/php/opcache.md): Configure OPcache and JIT compilation for optimal PHP performance with OxPHP, including preloading and development settings.
- [HTTP Request API](https://oxphp.dev/en/docs/php/request-api.md): Object-oriented API for accessing HTTP request data in OxPHP, replacing PHP superglobals with a type-safe, lazy-loading interface.
- [Superglobals](https://oxphp.dev/en/docs/php/superglobals.md): How OxPHP populates $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, and php://input for each request.
- [Worker Class](https://oxphp.dev/en/docs/php/worker-class.md): Reference for the OxPHP\Server\Worker class — a unified runtime handle for worker introspection, the worker entry point, and per-thread metrics.
- [Dot-Path Blocking](https://oxphp.dev/en/docs/security/dot-path-blocking.md): OxPHP blocks access to hidden files and directories (starting with ".") to prevent exposure of sensitive configuration, version control data, and other dotfiles.
- [PHP Execution Deny-List](https://oxphp.dev/en/docs/security/php-deny.md): Block PHP execution at specific URI paths to harden legacy applications against uploaded PHP shells and unintended script exposure.
- [Symlink Allow Paths](https://oxphp.dev/en/docs/security/symlink-allow-paths.md): Explicit allow-list for symlink targets outside DOCUMENT_ROOT — Laravel-style storage links, shared asset volumes, multi-tenant uploads.
- [Trusted Proxies](https://oxphp.dev/en/docs/security/trusted-proxies.md): Configure OxPHP to extract the real client IP, protocol, and host from reverse proxy headers (Forwarded, X-Forwarded-For/Proto/Host).
- [Migrating Shared\* to an external store](https://oxphp.dev/en/docs/shared-state/migrating-to-external-store.md): When to promote in-process Shared\* state to Redis, NATS, or another durable store — the patterns, the semantic gaps, and the concrete migration shape for each Shared\* type.
- [Shared\Atomic](https://oxphp.dev/en/docs/shared-state/shared-atomic.md): Generic atomic int64 shared across PHP workers — load/store, swap, CAS, fetch-arithmetic and fetch-bitwise with explicit memory-ordering control.
- [Shared\Channel](https://oxphp.dev/en/docs/shared-state/shared-channel.md): Bounded MPMC channel shared across PHP workers, with fiber-aware send and recv that return value-typed results for explicit dispatch.
- [Shared\Counter](https://oxphp.dev/en/docs/shared-state/shared-counter.md): Atomic int64 accumulator shared across PHP workers — lock-free signed add, atomic exchange, compare-and-set, windowed reset via set(0).
- [Shared\Flag](https://oxphp.dev/en/docs/shared-state/shared-flag.md): Atomic boolean shared across PHP workers — kill-switches, circuit breakers, and one-shot markers with lock-free load/store/swap/compareAndSet and explicit memory ordering.
- [Shared\Map](https://oxphp.dev/en/docs/shared-state/shared-map.md): Process-wide concurrent hash-map for coordinating state across PHP workers — null-as-absence model, a single linearisable compareAndSet, lazy iteration, and cycle-safe nested Shareable values.
- [Shared\Mutex](https://oxphp.dev/en/docs/shared-state/shared-mutex.md): Cross-thread mutual exclusion over a stored value — atomic multi-step updates from PHP workers via withLock / tryWithLock / withLockTimeout with explicit wait policies.
- [Shared\* Naming Conventions](https://oxphp.dev/en/docs/shared-state/shared-naming.md): Naming conventions for the OxPHP\Shared\* concurrency API — the canonical method vocabulary (get/set, try*/timeout wait policies, is*, fetch*, compareAndSet) that every shared primitive follows.
- [Shared\* Observability](https://oxphp.dev/en/docs/shared-state/shared-observability.md): Introspection endpoints, Prometheus metrics, and diagnostic playbooks for the OxPHP\Shared\* primitives — inspect live registry entries, trace reachability graphs, and alert on saturation.
- [Shared\Once](https://oxphp.dev/en/docs/shared-state/shared-once.md): Run-once container — exactly one worker's factory produces the value, everyone else sees the memoised result, across the whole OxPHP process.
- [Shared\Pool](https://oxphp.dev/en/docs/shared-state/shared-pool.md): Process-wide bounded object pool for expensive per-thread resources — database connections, JSON parsers, HTTP clients — with strict budget, per-thread affinity, and idle-timeout eviction.
- [Shared\Registry](https://oxphp.dev/en/docs/shared-state/shared-registry.md): Name-keyed process-global handles for Shared\* primitives: one Map / Counter / Channel that every worker and every request converges on, without external stores.
- [Shared State](https://oxphp.dev/en/docs/shared-state/shared-state.md): Process-wide primitives (counters, flags, maps, channels, pools) that let PHP workers coordinate without an external store like Redis or APCu.
