I did another quick survey of what’s state of the art for PHP and Amazon’s Lambda (i.e. Serverless, i.e. Amazon will run a function for you in the cloud that can respond to HTTP requests and interact with Amazon’s various services, getting you out of the sys-admin business). One project I see cropping up in my various feeds is Bref. I wondered how they solved the whole “Amazon doesn’t support PHP in Lambda” thing.
Heavy that’s the most PHP thing I’ve read in a while Sigh. The article does go on to talk about the obvious problem (spinning up a new PHP CLI process to handle each request in real time, like we’re in CGI caveperson days), and that it comes with a 20ms performance penatly. I’d be curious to learn more about how well the Lambda function handles real-world web loads, as all my frozen caveman instincts say spinning up a process is expensive.
Weird, typical PHP, workarounds asside, using a framework like Bref is the way to go if you want to experiment with PHP in Lambda. While Amazon’s limitations may make the underlying implementation a bit janky right now, picking a framework means you can just write your PHP code. If Amazon ever gets around to providing real PHP Lambda support the framework authors can just update what their framework’s doing behind the scenes and your stuff should just run. Abstraction remains regeant.