Forum: Ruby Creating a ruby "CGI" script

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
barjunk (Guest)
on 2007-04-10 11:05
(Received via mailing list)
I have been working with one of the Mentors from
rubymentor.rubyforge.org.  Through our e-mail conversation and some
experimenting, I learned several things.  I am posting them here
because I think it is helpful to all who might come after me and to
show my appreciation for the help that has been given.

There were several parts to making a 'CGI' script using ruby:

- Configuring the apache server(that's what I was using):  Some
important points are to have the Options +ExecCGI options for your
particular site and for ScriptAlias to be pointing at the directory
that contains the intended ruby script.  Looking at the apache log
files started me in the right direction for these things.

- Writing the script:  There is a reasonable example in the online
book ( http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html ).
However, what it didn't mention is that you can test things by
executing the program on the command line and providing your
environment variables to the script followed by a control-D.  I found
this after googling a little.

- Setting permissions:  This is obvious for most people...but it
should be mentioned.  The permissions on your script need to be set so
that your webserver will be able to read and execute them ( anyone
want to share best practices here?)

It would be great if others with way more experience could clear up
any mistatements I might have made because of my lack of experience.
Best practices examples are most welcome.

Thanks.

Mike B.
SonOfLilit (Guest)
on 2007-04-10 11:16
(Received via mailing list)
On 4/10/07, barjunk <removed_email_address@domain.invalid> wrote:
> particular site and for ScriptAlias to be pointing at the directory
> - Setting permissions:  This is obvious for most people...but it
> Mike B.
>
>

Hello Mike,

glad you benefited from RubyMentor.

Would you two agree to post your conversation logs to the wiki?
Currently there's only mine and Samantha's, and I'd like there to be
more examples.

That and it being a great resource, too.


Aur
This topic is locked and can not be replied to.