News for hackers. Stuff that matters.
Re:Why We Stick With PHP (and don't move to Ruby or Python) by jrockway on Thursday February 24, 2011 @12:27PM (#2258846)
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.

Re:Why We Stick With PHP (and don't move to Ruby or Python) by Zak on Thursday February 24, 2011 @12:39PM (#2258909)
[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.

Re:Why We Stick With PHP (and don't move to Ruby or Python) by wvenable on Thursday February 24, 2011 @01:01PM (#2259026)
> 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.

Re:Why We Stick With PHP (and don't move to Ruby or Python) by kyenneti on Thursday February 24, 2011 @12:45PM (#2258942)
"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.)

Re:Why We Stick With PHP (and don't move to Ruby or Python) by uniclaude on Thursday February 24, 2011 @12:58PM (#2259008)
I'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/

Re:Why We Stick With PHP (and don't move to Ruby or Python) by jrockway on Thursday February 24, 2011 @01:31PM (#2259172)
The 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.

Re:Why We Stick With PHP (and don't move to Ruby or Python) by Joeri on Thursday February 24, 2011 @03:19PM (#2259655)
If 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.