From: "袝屑懈谢 袠胁邪薪芯胁 / Emil Ivanov" <emil.vladev@gmail.com>
Date: Sun, 24 Jun 2007 06:44:22 To:ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Web Ruby w/o Rails
Hi,
I want to start developing a web application in Ruby, but can't configure it
to work. There are so much options that I get confused
eruby, mod_ruby (which I think, but unsure, is depreciated), cgi, fastcgi...
I can't get the simple "hello world"
I'm with strong C# and PHP background
[...]
Add an HTTP background and you will be fine.
I will be very grateful if you help me get started.
We do not know what environment you are working
in and what your experience/knowledge is. So,
sorry if this answer is too basic or trivial.
The most common thing that is very likely to
be available on whatever web server you are using
might be CGI. Very likely that your web server has
a directory called cgi-bin. Ask your sysadmin or
- for Apache - check the httpd.conf to see details.
Assuming your web server has such a directory and
the execution of CGIs is enabled there (most often
the default setting), create a file in this directory,
name it 'test.rb' and put the following in this file:
#!/usr/local/bin/ruby
puts "Content-Type: text/plain\n\n",
"Hello world"
Of course,this is a very basic way to work.
However, using the modules ERB and CGI it is even
possible to keep design and logic separated.
It doesn't work?
- chmod 755 test.rb
- Did you forget the two newlines after the Content-Type line?
- Ask the administrator if your web server configured to run CGIs.
HM
路路路
-----Original Message-----