I’ve been working on a mockup for Theoryville, and I wanted to throw together a server-side script to respond to some simple AJAX requests. My first thought was to do it in PHP, but then I remembered that PHP is the least elegant language in the world. So, I figured, I’ll do it in Ruby! I wrote what I needed, uploaded it to the Apache server, and I was done—except for the minor detail that Apache wasn’t running the code.
I figured that fixing the problem would be a simple matter of adding an AddHandler line to the Apache configuration. At worst, installing some sort of mod_ruby. No such luck. Turns out mod_ruby was abandoned many moons ago. The reason? Efficiency. Starting and shutting down an application every time someone makes a query is a stupid, grossly inefficient way of doing things. But guess what? For many applications, folks don’t give a flying fork how many processes they spawn. They only care about being able to upload something to their existing web space and have it just work.
Example: You could write a fantastic new blogging platform in Ruby, but would it have Wordpress’s Famous 5-Minute Install? No shell access required! Just upload it, go to the instantly available web interface, and tell it how to find your database. You know, the one you set up using phpMyAdmin?
Look, the Ruby community is rightly proud of Rails. I’m not saying that large or high-traffic web applications should run on PHP (though Wikipedia and Facebook somehow manage). But if you’re a Rubyvangelist, you need to fight on every front you can—including the just-upload-it-to-Apache front. It’s great that you’ve made installing and running a specialized web server take just 4 shell commands. But for most folks, that’s 4 too many.
Rubyists, I urge you: you need to bring back mod_ruby, for all our sakes. Anything PHP can do, Ruby can do better.
[Addendum: It’s worth mentioning that there is a solid mod_python, and it behooves all Apache administrators to install it. Also, I was able to rescue my Ruby script the old-school way: CGI. I added #!/usr/bin/ruby as the first line of the file and changed the extension to .cgi. I feel slightly dirty, but it works.]
[Update 1/9/10: While I thought the title was original (at least, to the extent that any hyperbolic title is), it turns out there was an excellent post also called PHP Must Die back in the dark days of 2004 about how Python and even *shudder* Perl are better languages than PHP. I took this fact as a given for this post. Via Hacker News.]
Tags: codingNo Comments

0 responses so far ↓
Comments are closed.