PHP vs Rails

December 1st, 2005, By Duncan Gough

I honestly didn’t want to comment on the recent PHP backward compatibility problems, as well as the ’stfu’ response from certain members of the PHP development team. However, when Marcus admits to seriously looking at Ruby as a result of this kind of attitude, it’s time to think twice about the future of PHP. Which, of course, if PHP 5. Which, sadly, is suffering from slow adoption by the ISPs and shared hosting solutions that contributed so much to the huge success of PHP 4:

PHP Stats

To which, of course, the only solution is PHP 6. Clearly, I’m not keen on so many PHP developments that are fragmenting the core language at a time when more and more people are using it for quick prototyping and simple, database driven website whilst Zend seems convinced that PHP can work side by side with Java in the Enterprise in a step that seems too much like a foolish first step down the path of the three E’s

All things being equal, is PHP dead?

Well, given the competition in Django and Ruby on Rails, the answer to that question could well be yes.

Zend obviously takes the new frameworks seriously, given that they have already started to build their own. Now, given that the developers working on that framework are experienced and clever enough to make the best of the code do the other frameworks, Ruby on Rails, in particular, have the initiative?

Yes.

Why? Because RoR looks to be in exactly the same position as PHP was several years ago. If I were a young developer looking to build my first website, I’d pick RoR. When I started, PHP was the obvious choice compared to everything else because it did a lot of the basic stuff for you. Fuctions like stripslashes, nl2br, mysql_* and the magic of form posted variables globalised in your script made it easy to just pick up and go. Clearly, a lot of those ‘wins’ were in fact security nightmares that are still apparent now, but the comparison is valid. New developers were never going to work on banking systems where security was paramount. We were building web pages for our bands (with, gasp, tagging facilities before we knew what they were) and collaborative web pages with an admin section for updating the content without coding the html by hand (or, in other words, blogs before they were called blogs). Creating those things in any other language than PHP was just stupid (hello ASP).

Now, of course, if a young developer wants a blog, they install WordPress or get a TypePad account. If they want a web page for their band, they may as well use MySpace or their own blog. Or, if they want to build their own, are they going to create a secure PHP framework that hits all the relevant design pattern sweet spots, and what version of PHP will they use? Or, are they going to pick up RoR, use the scaffolding to take care of the basic form handling and validation and maybe even throw in some cool looking AJAX too?

And if you think it doesn’t matter what newbie developers use, look again at the graph. There are an awful lot of newbies out there, who chose PHP. Now that RoR offers so much more in comparison, is it good for newbies to pick it up? Well, what do you think they’ll use when they get their second job? As someone in the same position several years ago, I remember taking jobs as a PHP developer and seeing more experienced people with ‘out of date’ skills (Oracle, batch processing, etc) going in the other direction. It’ll happen again, PHP developers will be moved on whilst RoR developers will build the cool stuff. Simple web-apps, built on-top of RoR, building on top of REST, XHTML and CSS standards.

Two updates:

1/ Phil Mccluskey points to the latest usage graph for PHP that shows a continuing increase. It’s worth pointing out that I was just using the usage graph to lighten up all of the text in this post, I wasn’t attempting to show that PHP usage was tailing off. Whilst I do think that’ll happen more and more now, because of Ruby on Rails, that is something that will take years.

2/ David Heinemeier Hansson makes some very salient points about the new Zend framework. I’m not wholly in agreement with his sentiments since I don’t think it’ll take a ’superhuman’ effort to write a worth PHP framework, however it’s a good, quick post. From my point of view, Zend needs to create a framework that is secure and standard. Ruby on Rails has many, many good points but it’s the ‘on Rails’ part of it that PHP really needs to emulate.

And another update, I’ve expanded on the whole PHP vs. Rails idea in more detail.

2 comments

« Casually MicrosoftInput Type Equals Huge »