Friday, August 24, 2012

fastcgi on godaddy gotcha

I'm a plain person and completely out of net epoch. But I'm a guy with curiosity. I want to know how fastcgi works. So I try it on godaddy.

First, I find this link
http://forums.hostingplayground.com/showthread.php?t=348
where a piece of test code is posted:

#!/usr/local/bin/ruby

require 'rubygems'
require 'fcgi'

counter = 0

FCGI.each_cgi('html3') do |cgi|
   counter += 1
   cgi.out {
     cgi.html {
       cgi.body {
         cgi.h1 { "Hello World!" } +
         cgi.p { "Counter: #{counter}" }
       }
     }
   }
end
And I put this piece in html/cgi directory. It works but works like regular cgi? What's wrong here? At least I trust godaddy's claim on supporting fastcgi.

Then, I come across a page that change the file name extension. It was a ruby file but with .cgi as the extension. I realized that I have to try some new extension. So I rename the file with .fcgi extension. And it works!

No comments: