# Runy newbie question

**URL:** <https://www.ruby-forum.com/t/runy-newbie-question/84615>\
**Category:** Ruby\
**Created:** [February 6, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/runy-newbie-question/84615 "2007-02-06T13:51:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [February 6, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/runy-newbie-question/84615/1 "2007-02-06T13:51:13Z")

</div>

Dear all,

I’m a newbie at ruby and I have a few simple problems. First I  
installed apache and ruby on rails using the guide at  
[www.apacheguide.org](http://www.apacheguide.org). It appears to work fine.

Now, I have a ruby script that returns an XML file depending on the  
input parameters. This script works nicely when run from the windows  
command line.

However, I’m puzzled on how to launch it after a user clicks on the  
“Submit” button on my website. What happens now, is that IE or FF  
wants to download the .rb file.

Do you have any good online examples to share ?

Thank you,

Nick,

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [March 1, 2007, 2:23am UTC](https://www.ruby-forum.com/t/runy-newbie-question/84615/2 "2007-03-01T02:23:55Z")

</div>

> Now, I have a ruby script that returns an XML file depending on the  
> input parameters. This script works nicely when run from the windows  
> command line.
> 
> However, I’m puzzled on how to launch it after a user clicks on the  
> “Submit” button on my website. What happens now, is that IE or FF  
> wants to download the .rb file.

It works on your computer when you click the submit button but not on  
your website when you click submit?

Harry

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [March 1, 2007, 8:34am UTC](https://www.ruby-forum.com/t/runy-newbie-question/84615/3 "2007-03-01T08:34:30Z")

</div>

The problem is that your ruby script is also a text file and apache  
doesn’t know if you’d just like to give back a text file or execute  
the script. Per default, it does the safer option, which is just  
return the text.

> This script works nicely when run from the windows  
> command line.
> 
> However, … on my website, … IE or FF  
> wants to download the .rb file.

You need to configure the server to handle cgis. You can either do  
this in the global Apache configuration or in a file called  
`.htaccess` which alters the configuration for the directory you’re  
located in. You’ll need to require something along the lines of:

Options +ExecCGI

to instruct the server that execution of cgi’s is generally allowed,  
and:

AddHandler cgi-script rb

for Apache to treat .rb files as cgi’s. Not sure how this is handled  
on Windows, but the script also needs to be executable (chmod +x on  
unix).

Sort through the Apache manual, start here:  
[http://httpd.apache.org/docs/1.3/howto/htaccess.html#cgi](http://httpd.apache.org/docs/1.3/howto/htaccess.html#cgi)

Cheers,  
-tim
