Jump to content

Recommended Posts

Posted

Problem

 

I cannot seem to be able to add the cgi-script handler for ruby scripts (.rb).

 

I can run perl, python, and ruby scripts using the .cgi extension.

 

I can run perl (.pl) and python (.py) scripts without adding any handlers.

 

Interestingly, I can run perl scripts using any file extension without adding any handlers.

 

I cannot run python or ruby scripts using any other extensions, even if I add handlers.

 

 

Handler Examples

 

I've tried adding it to the cPanel / Apache Handlers:

handler: cgi-script

extensions: .rb

 

I've also tried adding it to the .htaccess file:

http://alexanderhawley.com/cgi-bin/.htaccess

AddHandler cgi-script .rb

 

 

Perl Examples

 

Perl works with extensions .cgi, .pl.

No additional handlers needed.

 

http://alexanderhawley.com/cgi-bin/testperl.cgi

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "perl";

 

http://alexanderhawley.com/cgi-bin/testperl.pl

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "perl";

 

 

Python Examples

 

Python works with extensions .cgi, .py.

No additional handlers needed.

 

http://alexanderhawley.com/cgi-bin/testpython.cgi

#!/usr/bin/python
print "Content-Type: text/plain\n\n"
print "python"

 

http://alexanderhawley.com/cgi-bin/testpython.py

#!/usr/bin/python
print "Content-Type: text/plain\n\n"
print "python"

 

 

Ruby Examples

 

Ruby only works with .cgi extension.

Ruby does not work with .rb extension.

 

http://alexanderhawley.com/cgi-bin/testruby.cgi

#!/usr/bin/ruby
print "Content-type: text/html\n\n"
print "ruby"

 

http://alexanderhawley.com/cgi-bin/testruby.rb

#!/usr/bin/ruby
print "Content-type: text/html\n\n"
print "ruby"

 

 

Thoughts?

 

Thanks.

 

 

-AH

Posted

Okay, so it looks like it should work without adding any handlers.

 

According to the HelioHost feature info.

 

http://heliohost.org/home/features-mainmen...enu/rubyonrails

Ruby scripts are easy to configure and run. Just create a file in your cgi-bin directory under public_html, and place the Ruby "shebang" line (#!/usr/bin/ruby) on the first line of the file. Below this line you may write Ruby code. Make sure you make this file's CHMOD permissions 755, and output a Content-type header before anything else.

However, "Just create a file" isn't accurate.

 

Perl is the only language that works with any file extension and no file extension.

 

Python works with .cgi and .py extensions and no extension.

 

Ruby works with .cgi extension and no extension.

 

Thoughts?

 

Thanks.

 

 

-AH

Posted

The administrator is the only person who can give you any insight on this and he's been missing in action for a few weeks. Sorry!

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...