Runy newbie question

Discussion in 'Ruby' started by Nick, Feb 6, 2007.

  1. Nick

    Nick Guest

    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. 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,
     
    Nick, Feb 6, 2007
    #1
    1. Advertisements

  2. Nick

    Harry Guest

    > 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

    --
    http://www.kakueki.com/ruby/list.html
    Japanese Ruby List Subjects in English
     
    Harry, Mar 1, 2007
    #2
    1. Advertisements

  3. Nick

    Tim Becker Guest

    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

    Cheers,
    -tim
     
    Tim Becker, Mar 1, 2007
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jenny

    dotnet newbie question

    Jenny, Jul 13, 2003, in forum: ASP .Net
    Replies:
    9
    Views:
    1,388
    K_Lee
    Nov 6, 2003
  2. Id0x
    Replies:
    4
    Views:
    1,445
    Erik Max Francis
    Jul 21, 2003
  3. Adam
    Replies:
    0
    Views:
    515
  4. cjl
    Replies:
    3
    Views:
    1,155
    John Nagle
    May 21, 2007
  5. JohnE

    newbie with newbie questions

    JohnE, Aug 17, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    766
    Gregory A. Beamer
    Aug 17, 2009
  6. Jerry C.
    Replies:
    8
    Views:
    576
    Uri Guttman
    Nov 23, 2003
  7. moonhkt
    Replies:
    2
    Views:
    351
    Chris Angelico
    Sep 16, 2012
  8. Dennis Lee Bieber

    Re: Newbie to python. Very newbie question

    Dennis Lee Bieber, Apr 7, 2013, in forum: Python
    Replies:
    1
    Views:
    155
    Miki Tebeka
    Apr 8, 2013
Loading...