6 ms·
I know this will sound like an echo chamber: But PHP is on the decline. Its only hanging on barely because of wordpress. Let me explain. The web changed. The
by phplovesong 4y ago
I know this will sound like an echo chamber:
But PHP is on the decline. Its only hanging on barely because of wordpress.
Let me explain.
The web changed. The web evolved. Too fast for PHP to catch up, and fundamentally the web today is not compatible with the PHP way of exec + die immediately.
The web is more and more real time, all sorts of events fired thru sockets, work queues, and state is stored both on the client and on the server. PHP is not up for this task. This is why people have been moving away from PHP for the last decade, and this will only increase as time goes by.
Finally, please dont even start with that "nodejs clone in PHP" as its just a hack. If you use a node-js clone (there are many options) built in PHP you cant use any of the core stdlib, as its all blocking by nature, so for me and many others its a non starter.
PHP did a good job in evolving the web. Late 90s and early 2000s websites was the start, now its time to use better tech and continue forward.
Thanks PHP, but your time is up, its now time to say good-bye!
- Nextgrid 4y agoModern PHP frameworks work around the issue where the web server directly executes PHP files targeted by the request URL. They also provide nice abstractions that are battle-tested and secure. PHP is not my cup of tea (I can't be productive with the unintuitive function naming) but with a modern framework it can be proper. Laravel for example gives you a Django/Rails equivalent including task queues/etc, and becomes immune to the dumb vulnerability of uploading malicious PHP files in the media folder since all requests are routed through a single entry point rather than having the web server directly execute the PHP file.
- phplovesong 4y agoThis does not matter. PHP always starts, then exists immediately. This means you cant run something trivial as a websocket server in traditional PHP. I know theres some caching, but each request needs "the entire state" of the PHP app, and some frameworks like laravel or symfony are huge, and this is clearly visible when you notice how poor PHP performance is in basic req/sec benchmarks.
- gjsman-1000 4y agoWordPress is 25% of the internet. However, according to public metrics (https://w3techs.com/technologies/details/pl-php https://w3techs.com/technologies/details/pl-php), almost 80% of websites with known server-side programming language use PHP. PHP being only WordPress? Laughable. PHP dying? Also laughable. PHP is the choice for everybody but FAANG and Silicon Valley startups. But not even all of them - Facebook, Wikipedia, P*nHub, Slack, MailChimp, Tumblr, Etsy, all PHP or Hack (a stricter variant, diverging over time). (Yes, Slack is PHP, not Node!) > The web is more and more real time, all sorts of events fired thru sockets, work queues, and state is stored both on the client and on the server. PHP is not up for this task Go visit Slack then. They are literally built on PHP, and later moved to Hack, Facebook's stricter-typed PHP because Facebook was as well. If Slack doesn't need "all sorts of events fired thru sockets, work queues, and state" I don't know what does, and yet PHP is their foundation. They're fine, and PHP is fine.
- phplovesong 4y agoI would not trust those metrics you showed. Its almost impossible to get real numbers. But one fact is certain, wordpress is almost the entirety of PHP out there. Facebook tried to patch PHP twice, first with HHVM, then with Hack. Finally they gave up and announced Hack will be "its own language" because they were so fed up with the inconsistencies. Slack is really just a chat. A glorified, slow version of IRC. I would not boast it as a marvel of engineering. If you want to se how to build a good and scalable chat system? See Whatsapp. Dont get me wrong, PHP is still used, and will be after 10-20 years. But the fact reamins that is on a slow decline. Its never going to be as popular as it was back in the early 2000s.
- ls15 4y agoMost ecommerce websites are using PHP
- ofrzeta 4y ago> PHP is on the decline. Is it? That has been discussed here at every PHP release, recently with 8.1. PHP is getting the job done, runs everywhere, is fast and it becomes more safe with every release. There are modern frameworks like Symfony and Laravel (also take a look at PHP application servers Swoole or Roadrunner). You can even run a version of serverless Laravel, if you like (https://vapor.laravel.com/ https://vapor.laravel.com/). For realtime there is Laravel Broadcasting that can use services like Pusher or self-hosted alternatives like Soketi. Symfony supports Mercure. Honestly, what are you missing?
- phplovesong 4y agoFor starters a simple websocket server cant be built in traditional PHP. It will need some sort of hack like reactphp, and then you throw out all the stdlib i/o functionality. In 2022 (soon 2023) "it runs everywhere" does not matter. Who deploys on a shared hosting service anymore? I did not even know they existed anymore. With docker you can deploy any kind of exotic stack and "it will just work". PHP is not fast, a stock Laravel/Symfony app has poor req/sec benchmarks compared to almost anything else out there. Also the language still has all the warts it did in PHP5. Eg array_map/filter etc param order, no real unicode support, poor namespacing etc etc. Its just an overall bad development experience.
- ofrzeta 4y agoGuess what: Soketi isn't written in PHP.
- jayflux 4y ago> is it? According to GitHub yes https://octoverse.github.com/2022/top-programming-languages https://octoverse.github.com/2022/top-programming-languages Usage also declined year to year on the Stack Overflow survey.
- ofrzeta 4y agoOh, well, so it's declining according to Github stats. So is Ruby in this ranking. I like Python (which is ascending) but I don't think it's "better" than PHP according to whatever metric. Hey, I even like Java; Javascript not so much, not to talk about the ecosystem that comes with it.
- phendrenad2 4y agoWebsockets are still a niche needed by very few websites. Which niche are you building websites in, may I ask?