Content · Web Development · PHP

Running PHP Under FrankenPHP: Deployment Basics

FrankenPHP embeds PHP into Caddy and can run conventional web apps or persistent workers.

1 views Published Oct 17, 2026 Updated Oct 17, 2026 Admin

FrankenPHP embeds PHP into Caddy and can run conventional web apps or persistent workers.

What It Does and When to Use It


Run the relevant deployment or container command in the intended trusted environment. The web server handles HTTP, the PHP worker executes scripts, and CLI has separate configuration and lifecycle.

Requirements, Inputs and Expected Behavior


Confirm the runtime, extension, environment variables, and permissions before running the examples in production. Worker mode keeps process state across requests and requires resetting request-specific state.

Example 1: Basic Operation


Run the relevant deployment or container command in the intended trusted environment.

docker run --rm -p 8080:80 -v "$PWD/public:/app/public:ro" dunglas/frankenphp:1-php8.4

Example 2: Behavior and Validation


Confirm PHP version, extensions and INI paths in the target runtime.

php -v
php -m | grep -E 'pdo|openssl|mbstring'
php --ini

Practical Example: Application Use


Check actual service health and log output; adapt host and service names to deployment.

curl -fsS http://127.0.0.1/health || exit 1
sudo journalctl -n 30 --no-pager

Important Behavior and Edge Cases


The second example highlights: Confirm PHP version, extensions and INI paths in the target runtime. The practical example adds: Check actual service health and log output; adapt host and service names to deployment.

Comparison with Related Approaches


ApproachWhat changes
Web server, worker and PHP CLIThe web server handles HTTP, the PHP worker executes scripts, and CLI has separate configuration and lifecycle.
Choosing safelyCheck the effective configuration in the SAPI serving requests before changing production.

Common Beginner Mistakes


MistakeCorrect approach
Assuming successful execution proves the result is usableCheck the return value, required extension, and observable output of the specific operation.
Ignoring runtime and environment differencesVerify PHP version, SAPI, operating system, service access, and permissions before deployment.
Skipping operational constraintsWorker mode keeps process state across requests and requires resetting request-specific state.

Key Takeaways


  • FrankenPHP embeds PHP into Caddy and can run conventional web apps or persistent workers.
  • Check actual service health and log output; adapt host and service names to deployment.
  • Check the effective configuration in the SAPI serving requests before changing production.
Share this resourceSend this page to someone who may find it useful.