How to answer “What’s wrong with PHP?”


I spec’d a new project the other day. Nothing new, we do this all the time, probably a few dozen times a year. We went through the usual round of analysis, what kinds of people would use the system, what screens would it have, and what entities (types of data) it would need. In the end we settled on the amount of time each element would take, compiled up a total estimate, and created a proposal for the customer.

Throughout the process, as often happens, there was a conversation like this.

  • “The customer has mentioned PHP, it seems simple enough to do in PHP on the surface.”
  • “Yeah, but what about XYZ – last time we did that we got hosed by their host’s PHP settings.”
  • “Sure, but we can get that information up-front.”
  • “Yeah, but there’s a lot of fields here. I’d like to give Symphony a shot.” (Symphony is a PHP framework)
  • “We can’t do that. Symphony requires PHP5, and PHP was chosen so they can work with regular shared hosting, and shared hosting providers don’t generally offer PHP5.”
  • “They will by next year, PHP4 will no longer be supported after December.”
  • “They need to host it this year though. We could get them to specify PHP5 when looking for hosting. Wait-a-sec, if we’re going to require them to obtain specialized hosting, why don’t we just use Rails?”
  • “Hells yeah, that would work.”

And lo, the project became a Rails project instead of PHP.

So, what caused the conversation to go this way?

I’ve been programming PHP for years. Don’t much like it. Why do I keep doing it? In the end, every time we look at it, the ONLY reason we ever do a project in PHP is because it’s part of a web site and must be supported in a shared hosting environment. That’s it. None of our developers enjoy working with PHP – it’s poorly documented, quirky, and nearly impossible to debug.

Why is it so popular? It all comes down to PHP itself and the community that thrives on it. Most web projects are small projects, with little actual programming. PHP developers can get by with a little syntax and some basic programming constructs like conditionals, loops, and function calls. Hosting providers can simply pick the off-the-shelf control panel software on which to run their business, and it supports PHP. It’s the lowest common denominator in the hosting market.

PHP supports few useful programming idioms. It doesn’t support the simplest of object-oriented constructs, never mind the tremendously time saving constructs such as the mix-ins or continuations you get in Ruby. In fact, I’d estimate in PHP4 I get to use maybe 20% of my programming bag-of-tricks.

As a result, it’s a “good enough” technology for most. It “gets the job done”, and it’s reasonably simple to work on (though if I see one more fool programming PHP live on their production web environment I’m gonna scream).

So, what if you’re not happy with “good enough”?

That’s where we’re at. We’re not happy with “good enough”, and “good enough” is certainly not what we want for our customers.

So, it turns out we may lose this project because it’s too expensive, and too hard to host. It’s too bad, because it would have been superb.


3 thoughts on “How to answer “What’s wrong with PHP?”

  1. > I’d estimate in PHP4 I get to use maybe 20% of my programming bag-of-tricks.

    If you’re completing PHP (or whatever language) projects with only 20% of your tricks, it speaks a lot about the power of PHP (or whatever language).

  2. > If you’re completing PHP (or whatever language) projects with only 20% of your tricks, it speaks a lot about the power of PHP (or whatever language).

    I agree, it normally would.

    However in this case, it’s a matter of required effort and code volume. It’s like building a house with a hammer. At some point, you need a saw, and probably a few other tools to get the job done in a reasonable time. And in the world of commercial software development, getting things done in a reasonable time is money the customer didn’t have to spend, or even better, money in your pocket.

    In the end, I wish the hosting market wasn’t in the terribly dismal state that it’s in. I’d like to be able to recommend PHP5, or Rails, or Java without jumping through hoops.

    I guess if hammers are $1, and saws are $1,000 a lot of people are going to try to cut wood with their hammers. Doesn’t mean it’s a good idea 🙂

  3. csavolainen

    I agree with the lowest common denominator scenario. It sounds bad but PHP is generally adopted by non-programmers because “It’s easy! Anyone can do it”. That’s great that it has a low entry point and that people are encouraged to try programming. Contrary to the current trend however, popularity does not make something better. It does however tend to push people toward whatever the “hip” new thing is and that’s where we currently are. Only getting to use 20% of your “bag of tricks” is not necessarily a good thing. Would Superman be a better Superhero if he only got to use 20% of his power?

    I don’t know about anyone else but I think I’ll use the tools required to build my house; custom tools where decent ones don’t currently exist.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s