Home: Roshan Kc

← All posts

PHP · Performance 5 min read

FrankenPHP vs PHP-FPM: Should You Switch in 2026?

Direct answer: FrankenPHP can replace nginx + PHP-FPM with a single server that runs PHP in threads and handles HTTPS and HTTP/3 itself. In classic mode it behaves like FPM, so you get simpler operations with little code risk. The big speedup only comes from worker mode, which needs code that's safe across requests. Switch if you want simpler deploys or worker-mode performance; stay on FPM if it's working and you rely on extensions FrankenPHP doesn't support.

PHP-FPM has been the default way to run PHP for about fifteen years, and "default" is underrated: every host, tutorial and monitoring tool understands it. So the question isn't whether FrankenPHP is good. It's whether moving is worth it for your app. Here's how I'd decide, and the migration path that keeps risk low. If you're also weighing Swoole, see FrankenPHP vs Swoole.

How FrankenPHP and PHP-FPM differ#

PHP-FPM is PHP's FastCGI process manager. nginx (or Apache, or Caddy) accepts the HTTP request and hands it to a pool of PHP processes over FastCGI. Each request boots your app from scratch, and the pool size (pm.max_children) caps how many requests run at once.

FrankenPHP is one process: Caddy's web server with PHP embedded, running requests on PHP threads. No FastCGI hop, no separate nginx config. It has two modes:

  • Classic mode boots the app per request, just like FPM. Same mental model, fewer moving parts.
  • Worker mode boots the app once per thread and keeps it in memory. That's where the throughput gains come from, and where the state bugs come from too.
nginx + PHP-FPMFrankenPHP
Processes to runTwo (web server + FPM pool)One
PHP buildStandard (non-thread-safe)Thread-safe build, embedded
Concurrency settingpm.max_children processesnum_threads / max_threads (can be auto)
Per-request bootAlwaysClassic: yes. Worker: no
HTTPS and HTTP/3Configured in nginxAutomatic
Extension supportEverythingThread-safe extensions only
Crash blast radiusOne child processCan be the whole server (see below)

Should you switch?#

Switch if:

  • Your config is nginx + FPM + certbot + supervisor and you'd like it to be one binary or one container.
  • Profiling shows framework boot is a real share of response time and you're ready for worker mode (often via Laravel Octane).
  • You're starting a new project and don't have FPM habits to unlearn.

Stay on FPM if:

  • Response times are dominated by database queries. Changing runtimes saves a few milliseconds of boot and nothing else.
  • You depend on imap, newrelic or pcov in production. FrankenPHP's known-issues page lists them as unsupported because they aren't thread-safe.
  • You're on shared or managed hosting that only offers FPM.
  • Nobody on the team has time to own a new piece of infrastructure.

A low-risk migration path#

  1. Audit extensions. Compare php -m against FrankenPHP's known-issues list. If you use Imagick, plan to disable its OpenMP threading.
  2. Run classic mode in staging. A minimal Caddyfile is short:
    example.com {
        root * /app/public
        php_server
    }
    Your code doesn't change. Compare error rates and latency with FPM.
  3. Set thread limits deliberately. Defaults are based on twice your CPU count. Size them against your database's connection limit, just as you would pm.max_children.
  4. Add a supervisor. Since PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, exceeding the hard memory limit can stop the whole FrankenPHP server, not just one request. systemd, Docker restart policies or Kubernetes all work.
  5. Ship classic mode to production. Live with it for a few weeks.
  6. Only then try worker mode, ideally through Octane for Laravel (php artisan octane:install --server=frankenphp). Fix static state, set a max-requests limit, and make sure deploys restart workers.

Splitting "new server" from "new execution model" is the important bit. If something breaks, you know which change caused it.

Worker mode gotchas#

Worker mode is where most migration pain lives, and none of it is FrankenPHP-specific. It's the same list for Swoole and RoadRunner:

  • Request data in static properties or singletons leaks into the next request. The current user, tenant and locale must be resolved per request.
  • Memory leaks accumulate instead of vanishing at the end of a request. Recycle workers.
  • Deploys and security patches don't take effect until workers restart.

One more operational point: you now patch a web server, not just PHP. FrankenPHP shipped security releases fixing 7 and 17 vulnerabilities in October and November 2026. That's a healthy project responding fast, and it means you need to keep up. I wrote about why that matters in choosing a stack by patch velocity.

Frequently asked questions#

Is FrankenPHP a drop-in replacement for PHP-FPM?#

Mostly, in classic mode: your code runs per request as it does under FPM. You need a thread-safe PHP build, and a few extensions such as imap, newrelic and pcov are not supported.

Is FrankenPHP faster than PHP-FPM?#

In worker mode it usually is, because the app boots once instead of on every request. In classic mode the gain is small. If your requests are slow because of database queries, neither runtime will fix that.

Do I still need nginx with FrankenPHP?#

No. FrankenPHP is built on Caddy and serves HTTP, HTTPS with automatic certificates, HTTP/2 and HTTP/3 itself. Some teams keep a load balancer in front for other reasons.

What is the biggest risk when moving to FrankenPHP?#

Worker mode state leaks and the larger crash blast radius. Migrate to classic mode first, run under a supervisor, then adopt worker mode once your code is safe across requests.

Key takeaways#

  • FrankenPHP replaces nginx + PHP-FPM with one process that runs PHP in threads and handles HTTPS and HTTP/3 itself.
  • Classic mode gives simpler operations with FPM-like behaviour; worker mode gives the speed, with state-leak risks.
  • Stay on FPM if you're database-bound, on managed FPM hosting, or rely on imap, newrelic or pcov.
  • Migrate in two steps: classic mode first, worker mode later, with a supervisor and deliberate thread limits.

Sources#

Planning a runtime migration? Get in touch.