DEV Community

Indunil Peramuna
Indunil Peramuna

Posted on

Supercharge Your PHP Apps with FrankenPHP Classic Mode

FrankenPHP Hero Image

Supercharge Your PHP Apps with FrankenPHP Classic Mode

PHP deployment hasn't seen a shift this exciting in years. FrankenPHP is here, and while everyone talks about "worker mode", Classic Mode is the immediate upgrade your servers need.

I've written a comprehensive guide on how to replace PHP-FPM with FrankenPHP behind Nginx.

What is Classic Mode?

It allows FrankenPHP to act as a standard request handler, just faster and simpler than FPM. It integrates perfectly with your existing Nginx setups.

Why it's better:

  • 103 Early Hints: Speeds up perceived load times by sending assets before the page is ready.
  • Observability: Detailed Prometheus metrics and structured logging out of the box.
  • Robustness: Benefits from Go's memory safety for the server layer.

Static vs Dynamic (Glibc) Builds

One of huge advantages of FrankenPHP is the static build.

  • Static: Zero dependencies. Runs on Alpine, Debian, CentOS without needing libraries like libpng installed. Perfect for containers.
  • Dynamic: Uses system libraries. Better if you need specific system-patched versions of libs.

The Tool

I also released an open-source tool, frankenphp-classic-setup, which automates:

  1. Binary installation (smartly chooses Static or Dynamic based on need).
  2. Systemd service creation.
  3. Nginx configuration generation.
  4. CLI wrapper setup (use fphp instead of php).

The Guide

I cover the manual "hard way" to help you learn, and the automated "easy way" to get you into production fast.

Manual Steps Summary

  1. Download frankenphp.
  2. Set up a systemd service pointing to your doc root.
  3. Proxy Nginx to port 9000.

Automated Way

git clone https://github.com/iperamuna/frankenphp-classic-setup.git
sudo ./setup.sh
Enter fullscreen mode Exit fullscreen mode

Read the full technical breakdown and guide here


About the Author
Indunil Peramuna is a software engineer passionate about optimizing modern web infrastructure.

Top comments (1)

Collapse
 
sinni800 profile image
sinni800

Thanks. We currently use fpm on a website with 4000 requests/sec and 10 million daily unique users, so having an alternative on the back burner in case it causes problems at some point is good.