About serverless
Created
Reviewedbyfl
⚡
Servers invoked on demand.
What serverless hosting means for PHP, when it pays off, and where it hurts. A guide to Lambda-style functions, scale-to-zero containers, and the WASM edge.
'Serverless' is mostly marketing jargon. Every vendor stretches the label over whatever it happens to sell. The servers are still there, but only spun up and down on demand. The bill follows usage, not reserved capacity: pay for what runs, nothing when it doesn't.
Functions (FaaS) are small, stateless handlers the platform spins up for a single request, runs, then throws away. Usually FaaS leans on a backend service (BaaS): a managed database, auth, or storage, stateful. When people say serverless PHP, they usually mean the functions part.
Serverless PHP
Bref is a serverless AWS Lambda layer that packages PHP as a runtime. Lambda has no native PHP runtime, so PHP gets there through Bref. Where a platform lands depends on how close it stays to per-request billing and scale-to-zero.
- AWS Lambda is the archetype: per-request billing, scale-to-zero.
- Google Cloud Run sits further out, stopping when idle but running a normal container. "Serverless" databases that never scale to zero sit further out still.
- Laravel Vapor wraps Bref for Laravel.
- DigitalOcean and Scaleway ship a PHP function runtime of their own.
What serverless is good at
Some work fits serverless well:
- Spiky traffic. Functions scale out per request. A sudden burst does not need a fleet sitting there waiting for it.
- Idle apps. Scale-to-zero means near-zero cost at rest. Good for internal tools, seasonal sites, side projects.
- Event work. Image resizing, webhooks, cron jobs, queue consumers. They map onto functions without a fight.
Where serverless hurts
This is where a normal PHP app has to give things up. In short: complexity and likely increased costs.
- Cold starts. Waking from idle costs time. Bref adds around 250 ms, a heavy framework boot adds more. Keep an instance warm and the delay goes away, but so does the reason you left.
- No local state. The filesystem is throwaway and the next request may land somewhere else. File sessions, file caches, and local uploads all move to a shared store.
- No persistent database connections. Every cold environment opens its own. A burst can drown the database. Now you need a connection proxy or a serverless-friendly store.
- No long-running processes. Lambda stops after 15 minutes and has no daemons. Workers and cron jobs get rebuilt as event handlers, not
while (true)loops. - Local dev gets harder. Reproducing the function, its gateway, and its scattered state on a laptop is real work. Debugging turns into tracing across services.
- Steady traffic costs more. Per-request billing rewards irregular load. For always-on traffic it usually loses to a flat rate.
Is WASM serverless?
Not by itself. WebAssembly (WASM) is a compile target, a fast sandbox to run code in. Serverless is a billing and deployment model. They meet because some serverless edge platforms use WASM as their engine and trade container cold starts for near-instant ones. Run PHP as WASM on one of those and yes, it counts. On its own it is a runtime, nothing more.
As a way to host real PHP, it is early. Wasmer runs WordPress, Laravel, and Symfony at the edge, with rough edges around storage. Cloudflare Workers runs PHP only through the community php-wasm project, not as a first-class runtime. The slickest PHP-in-WASM today, WordPress Playground, runs in a browser as a dev tool, not a host. Worth watching. Not where production PHP lives yet.
Why fortrabbit
The opposite of all of it, the servers you rent and keep warm, the thing fortrabbit does, has a name too: serverful.
fortrabbit is not serverless, and that is on purpose. Apps run always-on, on ordinary PHP, with a real filesystem, real queue workers, and no cold start on the first request after a quiet night. The bill is a flat monthly rate for the component booked, not a meter that spikes the day a script loops.
Serverless is the right call for bursty, event-driven, or mostly-idle work. For that, use a function platform. We will point you at one. For a steady website or web app, where predictable latency, storage that stays put, and a bill you can guess matter more than scaling to zero, serverful is the shorter road. Not sure which one you are? The hosting guide works through the rest.
# Frequently asked
What does serverless mean for PHP?Servers run on demand
Servers run on demand - Code runs on demand, the platform scales it, and the bill follows usage instead of a monthly reservation. When nothing runs, nothing is charged. For PHP that usually means AWS Lambda through Bref, a scale-to-zero container on Cloud Run, or a native function on DigitalOcean or Scaleway.
#Is serverless the same as AWS Lambda?Lambda is one kind
Lambda is one kind - No. Lambda is the best-known Function as a Service (FaaS) platform, and Bref is the standard way to run PHP on it. But the textbook definition of serverless is broader — functions plus managed backend services (databases, auth, storage) that run themselves. In everyday PHP talk, serverless usually means the function part.
#Does serverless PHP have cold starts?Yes
Yes - Every scale-to-zero model pays a cold start when it wakes from idle. Bref adds around 250 ms of runtime overhead, plus whatever a Laravel or Symfony boot costs on top. On steady traffic cold starts are rare; on bursty or idle apps they are the first thing visitors feel.
#Is running PHP on WASM serverless?Related, not the same
Related, not the same - WebAssembly is a compilation target, not a hosting model. Some serverless edge platforms use WASM as their engine, so the two overlap — but running PHP compiled to WASM is still early and niche in 2026, not a mainstream production path.
#When does serverless PHP make sense?Spiky or idle traffic
Spiky or idle traffic - Serverless pays off for unpredictable, bursty, or low-volume workloads — event processing, webhooks, seasonal apps, side projects. For steady always-on traffic, a flat-priced host is usually simpler and cheaper.
#