7 ms·
I maintain a site that receives over half a million pageviews per day, not including API requests of XML feeds. This site runs on 3 medium range commodity web s
by giltotherescue 18y ago
I maintain a site that receives over half a million pageviews per day, not including API requests of XML feeds. This site runs on 3 medium range commodity web servers and 2 database servers, and there's plenty of capacity left.
Don't let the scaling police and architecture astronauts fool you: with the right architecture in place (i.e. a framework like Cake or Zend) and a smart scaling strategy (opcode caching, object caching, page caching, etc), PHP is a great choice for web applications.
Sure PHP has a low barrier to entry, which can lead to poor coding practices, but that shouldn't be a reason for people to express an absolute hate for it. Rather, it's important to stress continual education regardless of which programming language you choose.
- jrockway 18y agoSure, it scales. But it isn't a very good language. (The word "blub" comes to mind.) Here are features I like to have (in no particular order): * lexically-scoped variables (and closures) * lambdas * continuations * macros * an object system with a MOP (PHP and Java fail miserably here) * powerful regex engine (can be added via libraries, so not too critical) * extensive module library * flexibility (I want to write code my way, not the way someone else thinks I should write it; bye bye, Python.) Things that are nice to have: * multiple dispatch OO * partial evaluation * laziness PHP has none of these features. That's why I don't use it and don't recommend it. And oh yeah... PHP is a templating system too. I would rather get that as a library, not a core feature. (But I won't count that against them.) So what language does have all these features? None :) But, Lisp and Perl are good compromises. CL does everything except continuations and having a decent module library; Perl does everything except have pretty syntax and macros. Sadly neither of those languages has (by default) the "optional features", which is a shame. I ranted about this on my blog: http://blog.jrock.us/articles/Syntax%20and%20features.pod http://blog.jrock.us/articles/Syntax%20and%20features.pod Anyway, PHP is junk in terms of a programming language. It's fine if you don't know how to program, don't know what abstraction is, and don't like using libraries.
- wvenable 18y agoYour list of features has nothing to do with getting things done. They are almost completely academic.
- mnemonicsloth 18y agoBack to Trollinton with you.
- SwellJoe 18y agoTrue of maybe half of those features...but the other half? Well, if you don't know enough to miss them, I don't have any way to argue with you--there's no common language in which we can converse about them. But, I feel uncomfortable every time something I write takes two or three times the lines of code because of what the language lacks. First class functions or lambdas, closures, and a good library fall into this category...and PHP fails on all of them (there are many PHP libraries, but most are buggy and rather scary, and the standard library has ad hoc'ery written all over it...I like for the standard library to at least be a little bit planned out rather than crammed in via 3000 or so functions in the same name space). But PHP is a perfectly valid language for many classes of problem. Just be careful not to use it for the classes of problems for which it is extremely poorly suited.
- calpaterson 18y ago>Well, if you don't know enough to miss them, I don't have any way to argue with you--there's no common language in which we can converse about them. While I agree with your actual premise ; this statement is pretty bad form. It is the logical equivalent of a Christian saying that in order for me to critique his faith, I must become a Christian. Replying, "you wouldn't know; you're an imperative programmer" is moot; maybe he is an imperative programmer - but he could also be correct. There is no connection between the two. Deductive logic has never been allowed in the scientific method, which is, ultimately, the barometer of truth. I'm aware that Graham is the originator of this somewhat popular meme, but it's a wrong popular meme. The nature of ignorance of certain desirable features can only explain why people don't immediately demand them; it doesn't prove their usefulness.
- gm 18y agoHmmm... Interesting that, without cause, you gave such a defensive reply. I take it PHP has gotten a bad rap an not scalable? Any language can scale, if the implementation is designed correctly.
- agotterer 18y agoEveryone is going to put up an argument for different languages. There is no magical language that works for everything. It really depends what the project is. With that said. I work on a PHP site that does 5-9 million page views a day. We have an in house MVC framework. We use MySQL, memcached and APC hosted on a handful of solaris zones. We have no issues scaling and have coding policies that our development team tries its best to follow. PHP is a proven language, it has been around a long time and has a huge community. It really comes down to preference and objective. I personally don't use any of the open source frameworks available. But there are plenty of decent ones that will work just fine for small to medium sized sites. To anyone who says thats it's not a "real" language: do I care? It gets the same job done, it's proven to scale and it can turn a profit. Period.