Lessons to be learned from PHP
I’ve been reading this latest thread of posts around the net concerning Ruby and shared hosts, or equivalently, ease of installation. Here’s one. Here’s another. And I’m glad, for Ruby, that they are talking about this problem – I hope for their sake they take it seriously.
The history is this: first there were the dinosaurs, then there was the web. Then there was cgi scripting. Then there was perl and mod_perl which solved the performance issues that came along with cgi scripting. For awhile, that was the best game in town (according to me :). PHP, though, came along with a breakthrough idea – mod_php was an everything in one install. Unlike mod_perl, mod_php gave you a programming language, templating language and extension all in one. Once you installed it, you started making your .php pages and everything just worked.
mod_perl on the other hand, gave you nonesuch. In addition to installing mod_perl, you needed to select your templating language out of a myriad of options, install that as well, pick a file extension, then configure your apache to do the right things to the right files. mod_perl, of course, gives you much more power than mod_php – since mod_perl provides full access to all levels of the Apache API. The thing is, though, that most people, most of the time just want to make web pages.
The other thing that PHP did is make everything part of the core language. Everything. This has the nice effect of making it dead simple to use because there’s just so much functionality built right in. Of course, ultimately, this is a terrible language decision because you get saddled with tons and tons and tons of functions that you have to continue supporting and since PHP doesn’t have namespaces… Witness the problems when using PHP and mysql where you have a choice of three things, all built into the language – mysql, mysqli and now a move to PDO (their new DBI based system). Witness also the craziness that is their specific database method calls and how every conceivable action you might want to take was built in as a full on function but not uniformly across the different database specific functions… seriously, there’s an ibase_create_user function – with no counterpart for the mysql/mysqli versions.
I don’t think anyone is suggesting that PHP is a beautiful language, but it is one rooted in practicality and the needs of the bulk of web developers around and its vibrant community and wealth of applications and modules are a testament to that. I think that any languages that aspire to that level of popularity would be well served to take it into serious consideration.
Ruby has a system even more convoluted than mod_perl. That it wants its own web server that isn’t Apache is mildly (and by mildly, I mean completely) crazy. I’d say to continue their upward uptake (if indeed they are still in an upward trajectory) they need to simplify.
I wouldn’t mind seeing the Perl community do the same. I for one, would love a mod_mason that took mod_perl and bundled it with mason, DBI and DBD::mysql for a more all in one approach. Hmm… I wonder what’d be involved in that…