Lets do some CGI programming using Ruby this time. But first of all if you don't know how to setup your apache with Ruby for CGI, here is a small suggestion about how to setup an environment to run a Ruby based CGI script on your apache. Remember this is only for Apache.
1) Download load Ruby from http://www.ruby-lang.org/en/downloads/, and install it at your c:\ruby folder
2) Download EasyPHP from http://sourceforge.net/project/showfiles.php?group_id=14045, and install it.
That's It. Everything is set up. Now write the below hello world Ruby CGI script inside your hello.rb script.
## Below line for HTTP HEADER
print "Content-Type: text/html\n\n";
print "<head><title>Hello World</title></head>";
print "<h3>My First Hello Ruby! Program</h3>";
From the above code, the first line means where is your RUBY exe is located.
The Content-Type is defining the type of your content for browser to display.
Others are the printing HTML codes using Print command of Ruby. You can use puts command instead of Print.
Now, save the hello.rb script inside Program Files\EasyPHP x.x\cgi-bin folder.
Start your apache, and browse the ruby cgi script using the below URL
It will display My First Hello Ruby! Program at your browser.
That's enough for today. I'll discuss more about this things soon in future. Keep in touch. Thanks to all.