I had lunch today with Terry, we discussed a bunch of things. Many points and counter points were discussed.
One thing that I’ve known for a while and (he’s known for even longer), that I’ve wanted to say is this:
if you have to develop for the web, and you don’t know PHP, you should change that
I’ve used Rails, Java, Python, Perl, and maybe a few others for web development. These projects were prototypes, working projects, or simple hacks. In my experience, PHP has the best architecture for web apps that need to be up and running quickly and then stay up. It runs on just about any inexpensive hosting provider out there. If you put a tiny amount of effort in, it can even scale really, really well. If you want a great example, go check out this billion dollar company. Still not impressed, why not check this site out as well. They are using the same PHP that you have. Need another… how about this site.
The reason this is the case is because PHP was designed to work hand in hand with Apache. The multi-process,+shared nothing architecture wins versus the multi-threaded+stateful dead-end that people continue to follow. I could go on about this (and I think I already did in an older blog post). In a nutshell, shared memory, long running multi-threaded instances end up with all sorts of nasty problems (scheduling issues, dead-locks, containment/failure-isolation, non-linear performance, etc.). The PHP architecture nudges the developer down a path that has the right balance of interface, logic, and persistence. PHP apps will not fail due to resource leakage or heap bloat that long running instances end up with. It isn’t the huge nightmare to hosting providers that other systems are. PHP apps will have a consistent and predictable performance profile. When they do fail (process limits, IO limits, database limits), you can generally just add more hardware at the right layer and scale up. Now, granted, scalability gets more complicated and we can get into queuing models and yada yada, but I think you get the point.
Compare that wiith every other web-app platform that trys to keep some multi-threaded instance running to handle requests (Rails, Java, and Python, etc.). They all have their issues. In fact, I would say that the #1 problem for rails is still that they don’t have a clean, simple, and scalable platform. Mongrel is still not the answer… it is just the best answer.
Another interesting point about PHP which has been true for as long as I can remember (which Terry brought up first). If you can think of an app, it has probably already been written in PHP. Why write a forum system if you can just get vBulletin? Why write your own Digg when there are 3 clones already out there? PHP has a tremendous supply of working code, ready to run.
That reminds me of another popular, high traffic site that everybody uses every day.
So, just to recap before people take this the wrong way:
- I still love Ruby on Rails quite a bit. It was my first choice at BrightRoll and it was the right choice.
- I think PHP is excellent at what it does, and would use it even now for simple projects.
- PHP has issues and criticisms. However, I think the negatives and criticisms for other systems are larger for other systems (think Java or .NET)
- All of the above still works even for not-so-hot developers. Don’t believe me, just look at the code for some popular PHP apps 🙂
- I think all web developers should learn and understand PHP regardless of what they decide to use If you are choosing to ignore it then you may be going down the wrong path. Why would you want to do that?
- ALSO, mad props to JackH for pointing out “I think there is something there with this PHP stuff”. His input got me to really look at that tech.