5 ms·
I am wondering why php wasn't more popular? Think php as a serverless platform: 1. 10 minute to learn, simple syntax, rich functions 2. deploy with standard t
by est 2y ago
I am wondering why php wasn't more popular? Think php as a serverless platform:
1. 10 minute to learn, simple syntax, rich functions
2. deploy with standard tools like ftp
3. easy scaling with php-fpm.
4. not exactly docker, but vhost works in most cases. And vhost can be containerized.
5. insta hot-reload
6. dirt cheap cost. Hi dreamhost
7. no vendor lock-in bullshit, supported by everyone everywhere
well, at least it was the case used to be
- fastball 2y agoDoes PHP run your database? Your caching layer? Handle SSL? Can you run a queue with PHP? Would you? If your answer to any of those things is "no", then PHP isn't a serverless platform. It is a language that you use to build web applications. That makes it very different from Dokku, Kubernetes, etc. But yes, you're right that PHP is still a great choice for building the "web application" portion of your infrastructure.
- est 2y agoTo be fair, serverless platforms doesn't always provide queue or database. Usually they come alone with some sqlite or KV store for the convenience. SSL was provided by the php-fpm part, with either Apache or nginx, like most "platforms" do. Modern platforms may choose less-popular fronts like Caddy, and Caddy does support php_fastcgi.
- fastball 2y agoThe purpose of serverless is easily deploy applications without worrying about / managing infra at all. The only reason you don't need to run your own infra with PHP is because it doesn't do anything except the web application. As you noted, it doesn't even do the web-serving. Most serverless application platforms are then paired with hosted databases, hosted queues, etc, so that you don't need to manage those either. But yes, only some of those additional pieces can be described as "serverless", e.g. AWS Aurora is an actual serverless database, vs DigitalOcean's hosted Postgres, which does not scale in a "serverless" way. Regardless, minimal management of the database is required on these platforms. Dokku in turn is a replacement for those platforms and makes it easy to host your own [insert some part of your platform stack here]. That is the purpose of a PaaS, which is what Dokku is and what PHP certainly is not. Yes, the OP maybe should've said "My favorite personal PaaS", but that is less catchy, and I think calling it a "serverless platform" is close enough to the truth and gets the point across.
- est 2y ago> Most serverless application platforms are then paired with hosted databases > Dokku in turn is a replacement for those platforms and makes it easy to host your own I tried to search database site:dokku.com/docs/ or queue site:dokku.com/docs/ But failed to find anything relevant. Am I doing this wrong? Where does Dokku as a "replacement platform" provide the database or queue capability? > purpose of serverless is to provide scaleable infra which you don't need to manage > Dokku is an extensible, open source Platform as a Service that runs on a single server (from https://dokku.com/docs/ https://dokku.com/docs/) and how does Dokku on a single server solve the "scaling" problem exactly? > As you noted, it doesn't even do the web-serving Technically speaking, php can. https://github.com/swoole/swoole-docs/blob/master/modules/swoole-http-server/introduction.md https://github.com/swoole/swoole-docs/blob/master/modules/sw... it's just not widely used. Dont get me wrong, Dokku is a fine project of its own, but it doesn't seem to tackle the problems you mentioned either. On the other hand, if php is not enough, the LAMP can do everything.
- fastball 2y agoI'd recommend reading more thoroughly about Dokku (or PaaS in general) since it is somewhat clear you don't understand the value prop. Just grepping for certain terms isn't gonna get you very far. Dokku is Docker + Buildpacks + Orchestration. You give it a buildpack (developed/popularized by Heroku) to specify your application, which is the main "serverless" part. Then you tell Dokku that you want datastores or queues or whatever, via plugins[1]. Dokku handles pulling the relevant docker images, running them, and linking it all together. In other words, Dokku is open-source Heroku, where you can add databases and such with a single command, specify your app with a buildpack, and you're off to the races. If Dokku only did the application via buildpack part, people would not find it nearly as useful and PHP on a webhost somewhere would indeed be a good alternative. But Dokku is not that, it is a PaaS, so it can also run your PHP application just as easily. And if you're self-hosting Postgres and RabbitMQ via Dokku, why would you run your PHP on Dreamhost? You probably wouldn't, you'd throw a PHP buildpack up there and call it a day. [1] https://dokku.com/docs/community/plugins/?h=plugins#official-plugins https://dokku.com/docs/community/plugins/?h=plugins#official...
- hmaxdml 2y agoBut that's the reason why serverless has mostly failed so far -- because it is not stateful. And that is only because most existing offering don't have the correct primitives. By that I mean that if the programming model has a way to automatically capture state, an implementation framework can manage it automatically on behalf of the application, while the user (person writing the app logic) doesn't have to care about the state.
- dangus 2y agoI mean, it’s not like PHP is unpopular. According to the first thing I googled, it’s more popular than Go, and even higher up the list if you remove languages like C/C++ that aren’t typically used for web. https://www.hackerrank.com/blog/most-popular-languages-2023/ https://www.hackerrank.com/blog/most-popular-languages-2023/
- husarcik 2y agoFor the web, PHP remains #1. It's super fast, especially when using FrankenPHP or Swoole. Laravel has the fastest development velocity out of any framework available.
- v3ss0n 2y agoAll of those are easier in Python or Ruby or Javascript. And all of those languages have done thing properly to make you code lesser , better with lesser errors and better performance. Thats why PHP become a dinosaur. > not exactly docker, but vhost works in most cases You are understanding Docker and Vhost wrong then..
- est 2y ago> easier in Python or Ruby or Javascript Have you tried write anything with those on serverless™ platforms? They don't do things properly, serverless makes coding harder, yield more errors and poor performance. > better performance PHP8 JIT offers outstanding performance. > You are understanding Docker and Vhost wrong then.. chroot/jail'd multi-worker with inetd port fowardng solves the same problems as cgroup'd process and netns do. I'd argue it's a sidecar before it's cool. If you take extra steps like wrapping LXC for your web workers, you may even call your platform, wait for it, Heroku. https://devcenter.heroku.com/articles/dyno-isolation https://devcenter.heroku.com/articles/dyno-isolation
- deleted 2y ago[deleted]