6 ms·
The number one reason PHP is liked and adopted so much for the web is there is no state. Each and every request starts fresh, which reduces a lot of complexity
by nodesocket 12y ago
The number one reason PHP is liked and adopted so much for the web is there is no state. Each and every request starts fresh, which reduces a lot of complexity and the barrier to entry. Also, the fact that it is in itself a templating engine, makes it faster to produce apps.
- debacle 12y agoI think it's a self-enforcing trope, though, these days. Everyone uses PHP because every host has PHP. Every host has PHP because everyone uses PHP.
- chipotle_coyote 12y agoOddly, it was that realization -- more than all the other many nits people pick with PHP -- that started making me want to claw my eyes out when I thought about PHP. PHP has come a long way in many respects, but it's still fundamentally wedded to a 1999, CGI-ish model of the web: pages are fundamentally static entities that you add dynamic bits to as needed. It's a "template engine" because it's basically designed to embed scripts that we would have previously stuck in /cgi-bin right in your web pages. In that world, PHP was pretty awesome. But in a world of MVC frameworks, "every request starts fresh" means that on every request, the entire framework starts from scratch. It loads libraries and configuration files and ORMs and controller routing on startup -- and it has to do it every single time. Yes, I know things can be and are cached, precompiled, lazily loaded, etc., but that can't completely overcome that. From what I've gathered over the years, PHP is a pretty fast language -- but PHP frameworks consistently get their asses kicked in benchmarks, and I can't help but suspect there's a correlation.
- Iftheshoefits 12y agoRails consistently under performs Django, and both under perform HHVM, go, Java, and C++ frameworks. Benchmarks don't seem to be as important as the perceived social status of a language.