Serverless PHP: how does it really work?
summary
Bref runs PHP on AWS Lambda using PHP FPM behind Lambda Function URLs or API Gateway, mounted from container images and served inside Firecracker microVMs. Each Lambda instance handles one-request-per-instance concurrency with cold starts (hundreds of ms to ~1s depending on app size), prewarming reduces cold starts to ~0.01% of requests, and limits include 15 minute execution, 6 MB responses, and default instance caps that AWS raises on request. Deploys use composer plus a bref.yml and support S3, SQS, EventBridge, and Laravel Vapor.
AI-written summary · about
chapters (30)
- 0:00Serverless PHP hosting intro
- 1:04What is serverless
- 3:11Introducing Bref
- 5:59Deploy PHP app with Bref
- 6:43Live demo: Bref scaling
- 9:52How serverless PHP works
- 11:59Lambda instances and cold starts
- 14:31Firecracker behind Lambda
- 17:03Bref runtime and PHP-FPM
- 20:59PHP-FPM concurrency
- 22:24Scaling and request handling
- 24:29Cold starts impact
- 26:39Cost model with Bref
- 28:24Traffic spikes and costs
- 30:12Non-HTTP events with Bref
- 33:46Worker mode optimizations
- 34:48Who should use serverless PHP
- 37:22Real-world use cases
- 39:50When not to use serverless
- 41:14Q&A: Persistent opcache
- 44:23Q&A: AWS limits vs Vapor
- 47:57Q&A: Local dev and testing
- 50:04Q&A: Cost of long tasks
- 52:39Q&A: Instance scaling
- 54:24Q&A: Non-standard PHP extensions
- 55:57Q&A: AWS instance spawning
- 57:22Q&A: Cold start UX
- 58:05Q&A: DB credentials securely
- 59:10Q&A: Detecting cold starts
- 1:00:14Q&A: Bref usage tracking
related talks
39mServerless PHP applications with Bref
50mServerless PHP applications with Bref
44mServerless PHP applications with Bref
52mPHP on serverless, how it works under the hood
56mRunning Your PHP Site on AWS Lambda
02h 08mGoing serverless with PHP and Bref.sh
59mServerless PHP Applications
58mPHP on Lambda with Custom Runtimes
