5 ms·
In a post called "PHP in 2021" we really can't omit https://bref.sh/ https://bref.sh/ -- it allows running PHP apps on AWS Lambda effortlessly. With all the ser
by chx 6y ago
In a post called "PHP in 2021" we really can't omit https://bref.sh/ https://bref.sh/ -- it allows running PHP apps on AWS Lambda effortlessly. With all the serverless craze, it's a very important piece of the ecosystem. After writing PHP apps for two decades, I am absolutely stunned how easy it is.
Amazon blogged about it at https://aws.amazon.com/blogs/compute/the-serverless-lamp-stack-part-3-replacing-the-web-server/ https://aws.amazon.com/blogs/compute/the-serverless-lamp-sta...
- kijin 6y agoFor what it's worth, PHP has always been kinda "serverless". You just point the PHP interpreter at a file, and it runs the script contained in the file!
- slt2021 6y ago+1. PHP can easily host 1000 applications on a single node, while java people would struggle hosting 1000 docker contained spring boot monsters
- jfrunyon 6y agoMy sweet summer child...
- jfrunyon 6y agoThat's how literally anything which is "executable" works. You just point the interpreter (kernel, ld-linux, php, python, ...) at a file, and it runs the file.
- kijin 6y agoExactly, and PHP brings this simple intuitive behavior to the web. You just point your browser at a .php file, and the server runs the file for you.
- jfrunyon 6y agoSure, once you've set up the web server, and PHP itself, and installed (usually through a not-easily-wget'able link) the program you want, and configured it, and set up its permissions properly...
- muglug 6y agoFWIW Bref is cool, but it's AWS-only and still has a couple of orders of magnitude fewer daily installations than Laravel: https://packagist.org/packages/bref/bref/stats https://packagist.org/packages/bref/bref/stats vs https://packagist.org/packages/laravel/framework/stats https://packagist.org/packages/laravel/framework/stats.
- mtnGoat 6y agoNot sure they are comparable as they serve very different needs.
- porker 6y agoConsider that many Laravel installs will be done on CI servers.
- muglug 6y agoI guarantee that a larger % of the bref installs will be done on CI servers (bref is newer, and users of it are generally more advanced)
- yboris 6y agoI don't get it - the cheapest webhosts ($3/month) all let you run PHP - why would I need a cloud function when I have an always-on machine? And if it's for something with high traffic, why would you want a cloud function anyway? I thought they are meant for "runs sporadically, so why have a machine that's always on?" setup.
- paulryanrogers 6y agoWhen load varies you'll only pay while it's in use. Web-hosts without VMs or containers often promise a lot until you find their shadows limits. And those with VMs and containers can come out more expensive for some workloads. The landscape is changing too. So if your work is stateless or relatively low bandwidth, and has variable load then it's probably worth trying FAAS.
- chx 6y agoI am using a lambda to answer a webhook. The lambda function writes into SQS and in turns, SQS calls a queue worker automatically. Is this possible without AWS? Certainly. I was one of the two people who wrote the queue subsystem for Drupal more than a decade ago. And yet, AWS here does away with all the scalability concerns both up and down.
- mnapoli 6y agoWith your webhost, you have to setup and maintain the server, including patching/updating it, setting up SSL, etc. I used to do that for side projects, but I've had too many servers, and maintaining them was a pain. For something with high traffic, Lambda provides the instant scalability. Imagine servers autoscaling, but instantly. And again, without having to setup or maintain that.
- purerandomness 6y ago> With your webhost, you have to setup and maintain the server You're confusing a root server or a VPS with a webhost aka "shared hosting", where the hosting service takes care of Let's Encrypt certificates, and scheduled downtime for patching.
- ahofmann 6y agoSo since only a few decades I can do this: 1. create a shared hosting account for almost nothing (or literally nothing: https://www.000webhost.com/free-php-hosting) 2. write index.php 3. upload index.php 4. ??? 5. profit! But now, I can have the greatest and latest serverless multi-region, multi-something stuff with only these simple steps: 1. create AWS Account 2. follow these "simple" (nothing in AWS is simple) 4 steps to create AWS keys: https://bref.sh/docs/installation/aws-keys.html 7. #npm install -g serverless 8. #serverless config credentials --provider aws --key <key> --secret <secret> 9. #composer require bref/bref 10. #vendor/bin/bref init 11. edit index.php 12. #serverless deploy 13. ??? 14. no profit, because your stuff went viral and your AWS bill is killing you So at the end we have 14 steps to create something that potentially costs a lot and had an easier solution since about 1997. Awesome.