Troubleshooting eruby

A

Albert

Hello all.

I've been trying to use eruby lately for my website. I installed a
userspace copy of Ruby 1.8.2 and the latest eruby, following the
instructions as per http://tinyurl.com/6mkeb

So I can get Ruby scripts working fine (.rbx files) and if I add the
shebang to .rhtml files and make them executable I can get them to work
too. But plain .rhtml files end up confusing the server. I get the
following error message:

File does not exist: /home/albert/public_html/cgi/eruby/GetEnv.rhtml

where GetEnv.rhtml is sitting in public_html and eruby is the exectuable.
It's almost as if Apache can't figure out that eruby is the executable.

Manually running eruby shows no problems. I think this is an Apache
configuration thing, and I really hope it can be solved via .htaccess
instead of me going through the hassle of begging my host to change his
httpd.conf. Any ideas?
 
M

Mike Sassak

Hi,

This is probably a silly question, but is GetEnv.rhtml sitting in
public_html/ as described above, or in public_html/cgi/eruby/? If
that's the case, you may need a .htaccess file in public_html/ with
the requisite eruby directives, because .htaccess only affects the
current directory and those below it.

Anyway... this may be a mime-type problem. Looking at the link you
gave, the processing of .rhtml files depends on Apache being able to
correctly identify them as mime-type application/x-httpd-eruby. You
could add that in your .htaccess file using the AddType directive, if
your server admin allows it.

-mike
 
D

Dimitri Aivaliotis

Hello all.

I've been trying to use eruby lately for my website. I installed a
userspace copy of Ruby 1.8.2 and the latest eruby, following the
instructions as per http://tinyurl.com/6mkeb

This is a post from 2002 - I think it's quite dated...
So I can get Ruby scripts working fine (.rbx files) and if I add the
shebang to .rhtml files and make them executable I can get them to work
too. But plain .rhtml files end up confusing the server. I get the
following error message:

File does not exist: /home/albert/public_html/cgi/eruby/GetEnv.rhtml

It sounds like it's trying to execute the script via a cgi named
eruby, which doesn't exist. This shouldn't happen. There's an Apache
misconfiguration here somewhere.
where GetEnv.rhtml is sitting in public_html and eruby is the exectuable.
It's almost as if Apache can't figure out that eruby is the executable.

eruby should not be called on as an executable (it's a handler within mod_ruby)
Manually running eruby shows no problems. I think this is an Apache
configuration thing, and I really hope it can be solved via .htaccess
instead of me going through the hassle of begging my host to change his
httpd.conf. Any ideas?

All that should be necessary is:

<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
<FilesMatch ".rbx">
Options +ExecCGI
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</FilesMatch>
RubyRequire apache/eruby-run
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>


If you've got the *.rbx part working, try just putting the eruby and
*.rhtml relevant parts in your .htaccess file.

- Dimitri
 
A

Albert

Hello all.

I've been trying to use eruby lately for my website. I installed a
userspace copy of Ruby 1.8.2 and the latest eruby, following the
instructions as per http://tinyurl.com/6mkeb

...

Just a quick followup, after reading the Apache docs for awhile I tried
renaming eruby to eruby.cgi and it seems to have done the trick. Go
figure. Thanks for the responses everyone.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top