FrankenPHP: A Modern Application Server for PHP

FrankenPHP: A Modern Application Server for PHP

FrankenPHP has been getting a lot of attention in the PHP world, so I want to give a short, practical overview of what it is and why it might matter if you run PHP applications on your own server.

What FrankenPHP is

FrankenPHP is an application server for PHP. It is built on top of the Caddy web server and embeds PHP directly, so you don't need a separate PHP-FPM process behind a web server like Nginx or Apache. One binary serves your PHP application.

Why that is interesting

  • Simpler setup. Instead of configuring a web server and PHP-FPM and wiring them together, you run a single server.
  • Caddy features out of the box. Caddy is known for automatic HTTPS and modern protocol support, and FrankenPHP inherits that.
  • Worker mode. FrankenPHP can keep your application booted in memory and handle many requests with it, instead of bootstrapping everything on every request. For frameworks with a heavy boot process, this can make a noticeable difference in response times.

Things to keep in mind

Worker mode changes how your code lives in memory. Because the application stays loaded between requests, code that relies on global state or static variables being reset for each request can behave differently. Classic request-per-process mode avoids that, so you can start there and try worker mode once you're confident your code handles it.

As with any change to your server stack, test it on a staging setup before switching production over.

Should you try it?

If you manage your own server and like the idea of fewer moving parts, FrankenPHP is worth a look. If your current PHP-FPM setup works well and you have no performance problems, there is no rush. It's a good option to know about, not something you have to adopt today.

Tagged

No comments yet

Leave a comment

Security code

Comments are checked before they appear. See the privacy policy for how your data is used.