For over a decade, PHP’s share-nothing architecture via PHP-FPM has been its greatest strength: every HTTP request boots the framework, executes logic, sends a response, and tears down all memory. No state leaks, no zombie memory—just predictable execution.
With FrankenPHP (now officially supported in the PHP ecosystem and integrated into Laravel Octane), Worker Mode flips that model on its head.
In a standard Laravel application with 40+ service providers, Composer autoloading, config parsing, and container binding happen on every single request. Even with OPcache enabled, framework bootstrap alone frequently consumes 15ms to 35ms before your controller even executes a single query.
In FrankenPHP Worker Mode:
FrankenPHP boots your Laravel application once into RAM.
Incoming HTTP requests are handed directly to the already-booted worker loop.
Response latency drops dramatically for API endpoints and high-concurrency workloads.
Keeping the Laravel container alive across thousands of requests exposes bad habits that PHP-FPM quietly forgave:
Static Property Pollution:
// DANGER: This array persists across EVERY user's request in Worker Mode!
class PricingCache{
public static array $resolvedPrices = [];
}
If Tenant A’s prices are stored in a static property, Tenant B will inherit them on the next request handled by that worker.
Injecting Request/Auth into Singletons:
If a service registered via $this->app->singleton(...) receives Request or AuthManager in its __construct(), it holds onto the first request's user forever. Always resolve request-scoped dependencies inside methods or use app()->scoped(...).
Unclosed File Handles & Memory Creep:
Appending to in-memory arrays inside long-lived services without resetting state causes worker RAM to climb until --max-requests forces a worker restart.
Audit all singleton() bindings in AppServiceProvider.
Set --max-requests=500 so workers gracefully recycle and prevent slow memory drift.
Benchmark I/O-bound vs. CPU-bound routes—if your endpoint waits 400ms on an unindexed SQL query, Worker Mode won't save you. Fix Eloquent first, then eliminate boot overhead.