Apache2 conf and mod_ruby (mac os x 10.4.11)

in my httpd.conf i have :

LoadModule ruby_module libexec/httpd/mod_ruby.so
...
AddModule mod_ruby.c

and :
<IfModule mod_ruby.c>
  # for Apache::RubyRun
  RubyRequire apache/ruby-run

  # exec files under /ruby as ruby scripts.
  <Location /ruby>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
    Options +ExecCGI
  </Location>

# for rbx files
  <Directory /Users/yt/Sites/*>
    Options +ExecCGI
  </Directory>

# exec *.rbx as ruby scripts.
  <Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
  </Files>

  # # for Apache::ERubyRun
  RubyRequire apache/eruby-run

···

#
  # # handle files under /eruby as eRuby files by eruby.
  <Location /eruby>
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
  </Location>
  #
  # # handle *.rhtml as eruby files.
  <Files *.rhtml>
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
  </Files>

  # # for Apache::ERbRun
  # RubyRequire apache/erb-run
  #
  # # handle files under /erb as eRuby files by ERb.
  # <Location /erb>
  # SetHandler ruby-object
  # RubyHandler Apache::ERbRun.instance
  # </Location>

  # # for debug
  #RubyRequire auto-reload

  <IfModule mod_dir.c>
    DirectoryIndex index.html index.rhtml
  </IfModule>

  AddType application/x-httpd-eruby .rhtml
  Action application/x-httpd-eruby /cgi-bin/eruby

</IfModule>

however any attempt to read a *.rbx or *.rhtml gave me the text content
of the script itself.

i've checked the syntax of httpd.conf, according to apachectl -t, it is
correct.

i'm running Mac 0S 10.4.11 with :
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]
eRuby version 1.0.5

how could i debugg this stuff ?
--
Une Bévue

I'm not too familiar with it, but it may be an additional Option you
need to add or an AddHandler.
-R

···

On Mon, Apr 28, 2008 at 6:00 AM, Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:

in my httpd.conf i have :

LoadModule ruby_module libexec/httpd/mod_ruby.so
...
AddModule mod_ruby.c

and :
<IfModule mod_ruby.c>
  # for Apache::RubyRun
  RubyRequire apache/ruby-run

  # exec files under /ruby as ruby scripts.
  <Location /ruby>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
    Options +ExecCGI
  </Location>

  # for rbx files
  <Directory /Users/yt/Sites/*>
    Options +ExecCGI
  </Directory>

  # exec *.rbx as ruby scripts.
  <Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
  </Files>

  # # for Apache::ERubyRun
  RubyRequire apache/eruby-run
  #
  # # handle files under /eruby as eRuby files by eruby.
  <Location /eruby>
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
  </Location>
  #
  # # handle *.rhtml as eruby files.
  <Files *.rhtml>
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
  </Files>

  # # for Apache::ERbRun
  # RubyRequire apache/erb-run
  #
  # # handle files under /erb as eRuby files by ERb.
  # <Location /erb>
  # SetHandler ruby-object
  # RubyHandler Apache::ERbRun.instance
  # </Location>

  # # for debug
  #RubyRequire auto-reload

  <IfModule mod_dir.c>
    DirectoryIndex index.html index.rhtml
  </IfModule>

  AddType application/x-httpd-eruby .rhtml
  Action application/x-httpd-eruby /cgi-bin/eruby

</IfModule>

however any attempt to read a *.rbx or *.rhtml gave me the text content
of the script itself.

i've checked the syntax of httpd.conf, according to apachectl -t, it is
correct.

i'm running Mac 0S 10.4.11 with :
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]
eRuby version 1.0.5

how could i debugg this stuff ?
--
Une Bévue

thanks for your answer, i discovered, in the mean time, Apache 2, is
unable to load mod_ruby.so because of a symbol not found, expected in a
flat name space...

i fall back to Apache 1.3, the Apple's default wich works at least, for
the time being, with rbx files in any directory...

also i wanted to compile the latest mod_ruby, but it fails.

i suspect something wrong in my manuall Apache 2 install (i wanted to
link the latest mod_ruby with this apache 2)...

···

Roger Pack <rogerpack2005@gmail.com> wrote:

I'm not too familiar with it, but it may be an additional Option you
need to add or an AddHandler.

--
Une Bévue

Hi,

I'm using mod_ruby with apache 2.2.6 without any issues. I manually
compiled and installed both apache and mod_ruby so I'm not sure of how
much help I'll be.

My config is pretty simple:

LoadModule ruby_module /usr/local/apache2/modules/mod_ruby.so

<IfModule mod_ruby.c>

~ RubyRequire apache/ruby-run
~ <Files *.rbx>
~ SetHandler ruby-object
~ RubyHandler Apache::RubyRun.instance
~ </Files>

~ RubyRequire apache/eruby-run
~ <Files *.rhtml>
~ SetHandler ruby-object
~ RubyHandler Apache::ERubyRun.instance
~ </Files>
</IfModule>

It's installed here:

root@takk:/usr/lib/ruby/1.8# ls -la apache/
total 64
drwxr-xr-x 2 root root 4096 2007-11-05 17:03 ./
drwxr-xr-x 32 root root 4096 2007-11-05 17:03 ../
- -rw-r--r-- 1 root root 3664 2007-11-05 17:03 erb-run.rb
- -rw-r--r-- 1 root root 3381 2007-11-05 17:03 eruby-debug.rb
- -rw-r--r-- 1 root root 3229 2007-11-05 17:03 eruby-run.rb
- -rw-r--r-- 1 root root 6148 2007-11-05 17:03 query.rb
- -rw-r--r-- 1 root root 13949 2007-11-05 17:03 rails-dispatcher.rb
- -rw-r--r-- 1 root root 3626 2007-11-05 17:03 rd2html.rb
- -rw-r--r-- 1 root root 2353 2007-11-05 17:03 registry.rb
- -rw-r--r-- 1 root root 3428 2007-11-05 17:03 ruby-debug.rb
- -rw-r--r-- 1 root root 3956 2007-11-05 17:03 ruby-profile.rb
- -rw-r--r-- 1 root root 2461 2007-11-05 17:03 ruby-run.rb
root@takk:/usr/lib/ruby/1.8#

Let me know if I can be of further help.

Tiago Macedo

Une Bévue wrote:

···

Roger Pack <rogerpack2005@gmail.com> wrote:

I'm not too familiar with it, but it may be an additional Option you
need to add or an AddHandler.

thanks for your answer, i discovered, in the mean time, Apache 2, is
unable to load mod_ruby.so because of a symbol not found, expected in a
flat name space...

i fall back to Apache 1.3, the Apple's default wich works at least, for
the time being, with rbx files in any directory...

also i wanted to compile the latest mod_ruby, but it fails.

i suspect something wrong in my manuall Apache 2 install (i wanted to
link the latest mod_ruby with this apache 2)...

fine, thanks, i'l re-install, manually everything...

and let u know.

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

Hash: SHA1

Hi,

I'm using mod_ruby with apache 2.2.6 without any issues. I manually
compiled and installed both apache and mod_ruby so I'm not sure of how
much help I'll be.

--
Une Bévue

right now, *.rbx files are working but not *.rhtml.

with eruby the Apache2 server complains :
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: failed to require
apache/eruby-run
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: error in ruby
[Wed Apr 30 16:53:57 2008] [error] mod_ruby:
/opt/local/lib/ruby/1.8/apache/eruby-run.rb:45:in `require': no such
file to load -- eruby (LoadError)
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/eruby-run.rb:45
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: error in ruby
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: (eval):45: (eval):45:
uninitialized constant Apache::ERubyRun (NameError)
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: from (eval):45:in `value'

the line 45 of eruby-run.rb being :

require "eruby"

i did a test changing this line to the absolute path of eruby, without
any positive effect...

even my httpd.conf is slightly different from yours, i had to add :
  <Directory /Users/yt/Sites/*>
    Options +ExecCGI
  </Directory>

in order to get *.rbx files working...

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

Let me know if I can be of further help.

--
Une Bévue

I'm guessing you don't have eruby installed:

http://wiki.modruby.net/en/?eRubyQuestions

Tiago Macedo

Une Bévue wrote:

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

Let me know if I can be of further help.

right now, *.rbx files are working but not *.rhtml.

with eruby the Apache2 server complains :
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: failed to require
apache/eruby-run
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: error in ruby
[Wed Apr 30 16:53:57 2008] [error] mod_ruby:
/opt/local/lib/ruby/1.8/apache/eruby-run.rb:45:in `require': no such
file to load -- eruby (LoadError)
[Wed Apr 30 16:53:57 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/eruby-run.rb:45
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: error in ruby
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: (eval):45: (eval):45:
uninitialized constant Apache::ERubyRun (NameError)
[Wed Apr 30 16:54:23 2008] [error] mod_ruby: from (eval):45:in `value'

the line 45 of eruby-run.rb being :

require "eruby"

i did a test changing this line to the absolute path of eruby, without
any positive effect...

even my httpd.conf is slightly different from yours, i had to add :
  <Directory /Users/yt/Sites/*>
    Options +ExecCGI
  </Directory>

in order to get *.rbx files working...

ok, thanks, i'll read this wiki.

i suspect the test done with eruby on command line was done with an
older eruby not linked the Apache2 (?)
even erubis is working on command line, and part of it as cgi.

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

I'm guessing you don't have eruby installed:

http://wiki.modruby.net/en/?eRubyQuestions

--
Une Bévue

I'd like to add a question :
what i the role of this eruby ? I mean if i do :
$ eruby --version
eRuby version 1.0.5
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]

even i've tested eruby on cli...

also :
$ which eruby
/opt/local/bin/eruby

may be this isn't the "same" eruby ???
I'm confused about that...

···

Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:

ok, thanks, i'll read this wiki.

--
Une Bévue

Do you have anything similar to this?

root@takk:~# locate eruby.so
/usr/lib/ruby/1.8/i686-linux/eruby.so

This is what apache is requiring.

Tiago Macedo

Une Bévue wrote:

···

Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:

ok, thanks, i'll read this wiki.

I'd like to add a question :
what i the role of this eruby ? I mean if i do :
$ eruby --version
eRuby version 1.0.5
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]

even i've tested eruby on cli...

also :
$ which eruby
/opt/local/bin/eruby

may be this isn't the "same" eruby ???
I'm confused about that...

root@takk:~# locate eruby.so
/usr/lib/ruby/1.8/i686-linux/eruby.so

nope, but i do have :
/opt/local/bin/eruby (*)

which i symlinked to :
/opt/local/apache2/cgi-bin/eruby

what sounds strange to me:
previously i had the same setup BUT, reinstalling eruby (same version
numbers) and re-doing the symlink make it working...

I'm running Mac OS X 10.4.11

and also :
/opt/local/include/eruby.h
/opt/local/lib/liberuby.a
/opt/local/lib/ruby/1.8/apache/eruby-debug.rb
/opt/local/lib/ruby/1.8/apache/eruby-run.rb
/opt/local/lib/ruby/1.8/powerpc-darwin8.8.0/eruby.bundle

This is what apache is requiring.

may be u don't run the same OS ?

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

--
Une Bévue

I don't, I use linux but you need the library and for some reason you
don't have it.

Une Bévue wrote:

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

root@takk:~# locate eruby.so
/usr/lib/ruby/1.8/i686-linux/eruby.so

nope, but i do have :
/opt/local/bin/eruby (*)

which i symlinked to :
/opt/local/apache2/cgi-bin/eruby

what sounds strange to me:
previously i had the same setup BUT, reinstalling eruby (same version
numbers) and re-doing the symlink make it working...

I'm running Mac OS X 10.4.11

and also :
/opt/local/include/eruby.h
/opt/local/lib/liberuby.a
/opt/local/lib/ruby/1.8/apache/eruby-debug.rb
/opt/local/lib/ruby/1.8/apache/eruby-run.rb
/opt/local/lib/ruby/1.8/powerpc-darwin8.8.0/eruby.bundle

This is what apache is requiring.

may be u don't run the same OS ?

no, no, i have it, i'm sure about that.
and it works (ie. eruby under mod_ruby)
what surprised me is that : it was already installed but didn't work,
i've re-installed (same version) it and now it works...

it remains to me to get erubis working...

here i get a security error (proving that way that both eruby and erubis
are installed and working):
[Mon May 05 17:42:06 2008] [error] mod_ruby: error in ruby
[Mon May 05 17:42:06 2008] [error] mod_ruby:
/opt/local/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:6
2:in `eval': Insecure operation - eval (SecurityError)
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:6
2:in `result'
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/Users/yt/Sites/erubis/example3.rbx:15
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

I don't, I use linux but you need the library and for some reason you
don't have it.

--
Une Bévue

Honestly I don't know what's wrong, there is already a thread in
ruby-talk about the exact same issue with erubis and I'm not sure they
found a solution.

Tiago Macedo

Une Bévue wrote:

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

I don't, I use linux but you need the library and for some reason you
don't have it.

no, no, i have it, i'm sure about that.
and it works (ie. eruby under mod_ruby)
what surprised me is that : it was already installed but didn't work,
i've re-installed (same version) it and now it works...

it remains to me to get erubis working...

here i get a security error (proving that way that both eruby and erubis
are installed and working):
[Mon May 05 17:42:06 2008] [error] mod_ruby: error in ruby
[Mon May 05 17:42:06 2008] [error] mod_ruby:
/opt/local/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:6
2:in `eval': Insecure operation - eval (SecurityError)
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:6
2:in `result'
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/Users/yt/Sites/erubis/example3.rbx:15
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Mon May 05 17:42:06 2008] [error] mod_ruby: from
/opt/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

something in erubis is tainted, and i'm unable to untaint it, the reason
for the security error.

···

Tiago Macedo <tmacedo@student.dei.uc.pt> wrote:

Honestly I don't know what's wrong, there is already a thread in
ruby-talk about the exact same issue with erubis and I'm not sure they
found a solution.

--
Une Bévue