The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help in RUBY

Discussion in 'cPanel Developers' started by F_A_H_D, Oct 12, 2006.

  1. F_A_H_D

    F_A_H_D Active Member

    Joined:
    Sep 17, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    guys
    i walked on howtoinstallrubyonrails review
    i just want to try ruby
    i made anew user account on shared server & i give it shell access
    i tested this from shell
    ruby -e 'print "hello world\n"'
    hello world
    so it works nice from shell
    how i can test it from browser ????????
    is ruby file must take special extension ???
    is there any reconfiguration to httpd.conf server wide ???
    plz i need help
     
  2. Kasper

    Kasper Active Member

    Joined:
    Aug 26, 2004
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    Probably this helps:
    Install Ruby:

    cd /usr/local/src/ruby
    wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
    tar -xzf ruby-1.8.4.tar.gz
    cd ruby-1.8.4/
    ./configure && make && make install

    Next Ruby Gems:

    cd /usr/local/src/ruby
    wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
    tar -xzf rubygems-0.8.11.tgz
    cd rubygems-0.8.11/
    ruby setup.rb

    Once Gems are installed, install Rails:
    gem install rails

    Install FastCGI:
    cd /usr/local/src/ruby
    wget fastcgi.com/dist/fcgi-2.4.0.tar.gz
    tar -xzf fcgi-2.4.0.tar.gz
    cd fcgi-2.4.0
    ./configure && make && make install

    And mod_fastcgi for Apache 1.3+
    cd /usr/local/src/ruby
    wget fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
    tar -xzf mod_fastcgi-2.4.2.tar.gz
    cd mod_fastcgi-2.4.2
    /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
    /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so

    Now for Ruby fcgi:
    gem install fcgi

    You now need to edit your Apache config file.
    LoadModule fastcgi_module libexec/mod_fastcgi.so

    <IfModule mod_fastcgi.c>
    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi
    </IfModule>

    mkdir /tmp/fcgi_ipc/
    mkdir /tmp/fcgi_ipc/dynamic

    $ chown nobody.nobody /tmp/fcgi_ipc/ -R
    $ chmod 755 /tmp/fcgi_ipc/ -R


    $ cd /home/USER
    $ rails /home/USER/testapp
    $ cd /home/USER/testapp/
    $ ruby script/generate controller test
    $ cd /home/USER/public_html
    $ ln -s ../testapp/public rails



    #!/usr/local/bin/ruby
    require 'cgi'
    require 'rubygems'
    require_gem 'fcgi'

    FCGI.each_cgi do |cgi|
    content = ''
    env = []
    cgi.env_table.each do |k,v|
    env << [k,v]
    end
    env.sort!
    env.each do |k,v|
    content << %Q(#{k} => #{v}<br>\n)
    end
    cgi.out{content}
    end


    gem update mysql
     
Loading...

Share This Page