3 ms·
I don't think PHP is that good of a language to use for a glue from frontend to backend. Compared with Perl, Python, and Ruby, PHP is missing a number of impor
by jrockway 16y ago
I don't think PHP is that good of a language to use for a glue from frontend to backend. Compared with Perl, Python, and Ruby, PHP is missing a number of important features; ability to serve multiple requests in the same OS thread (coroutines / events), ability to abstract the database in an OO way (do they even have prepared statements yet?), and so on. Its JSON parser is also slow, and JSON is how browsers and servers communicate now.
Anyway, not buying it. PHP's asset is "you get MySQL and templating for free in pages served by Apache", but most web apps don't use MySQL, templating, or Apache these days.
- Zak 16y ago[PHP lacks] ability to abstract the database in an OO way I would dispute that this is a requirement for a good language. Object/relational impedance mismatch is a well known issue. It doesn't matter in some apps, but it does in others. The ability to do database queries by means other than manipulating SQL as strings is kind of useful though. most web apps don't use MySQL, templating, or Apache these days There's some syntactic ambiguity in this statement. Are you saying that most web apps don't use any of those anymore? I think even in the world of brand new web startups, you'll find a majority using at least one of those.
- kyenneti 16y ago"PHP's asset is "you get MySQL and templating for free in pages served by Apache", but most web apps don't use MySQL, templating, or Apache these days." So, what is database of choice for the web apps ? (I was thinking it is mostly MySQL. Looks like I am struck in old tech.)
- uniclaude 16y agoI'm no PHP fan, but you're a little wrong here. Please see [1], or provide a better source so we can all be enlighten. [1]: http://news.netcraft.com/archives/2011/ http://news.netcraft.com/archives/2011/
- jrockway 16y agoThe author of the article says he's using PHP for glue, not for writing CGI apps. There are certainly a lot of legacy apps are of the old-style "click a link, send HTML as a response". But the new "glue style" is about writing your web app as a JSON server that speaks HTTP, and then writing the UI in Javascript to run in the browser. That's what I'm saying nobody uses Apache for. The way people write new apps now is with high-performance server processes that can handle tens of thousands of clients per thread. Apache and PHP do not do that. 99.999% of the Internet is legacy apps, and so Netcraft statistics will tell you how people were writing apps 5-10 years ago.
- Joeri 16y agoIf you're serving tens of thousands of clients, each client has to have a very low server footprint, so that means you're not doing much in-memory manipulation of datasets. In business software, that would be the exception, not the rule. I think a big driver behind PHP is the simplicity of the model. Each request can pretend it exists in isolation, having the whole web server to its own. Simplicity + good enough = popularity.
- wvenable 16y ago> ability to abstract the database in an OO way (do they even have prepared statements yet?), and so on. PHP keeps on changing; this has been in the PHP core for years. > most web apps don't use MySQL, templating, or Apache these days. I disagree, most apps still use MySQL, templating, and Apache. But there is a whole class of applications, things like real-time chat, that PHP cannot handle well because it's tied to Apache.