Apache2 conf and mod_ruby (mac os x 10.4.11)

U

Une Bévue

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 ?
 
U

Une Bévue

Roger Pack said:
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)...
 
T

Tiago Macedo

-----BEGIN PGP SIGNED MESSAGE-----
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.

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:
|
|> 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)...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgXNAEACgkQxFuRTtCTMvJWnQCfWuYcBdFOUIrsmbth5vBdY7Q7
h+MAn28LQquclWD6JZRUoO8q/fGQNNdo
=eGxJ
-----END PGP SIGNATURE-----
 
U

Une Bévue

Tiago Macedo said:
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.

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

and let u know.
 
U

Une Bévue

Tiago Macedo said:
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...
 
T

Tiago Macedo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

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

Tiago Macedo

Une Bévue 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...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgbS+kACgkQxFuRTtCTMvJdRgCfUfxhCj1b4dBAR2jBzWWZocxv
tAIAn1gRtfBrARNQ4/aj83jkXHjJGskp
=u2DD
-----END PGP SIGNATURE-----
 
U

Une Bévue

Une Bévue said:
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...
 
T

Tiago Macedo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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:
|
|> 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...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgfGDIACgkQxFuRTtCTMvKXeACfZ8TmsXVBtQIaWAy6T8DfPj65
RsAAn2opKjP+g1M846pQe+AYssUwGMpW
=GNiO
-----END PGP SIGNATURE-----
 
U

Une Bévue

Tiago Macedo said:
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 ?
 
T

Tiago Macedo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

Une Bévue 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 ?
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgfTLUACgkQxFuRTtCTMvKPcACeKxsEuPsF8u6cxrbQJwTc1VHl
3O8AnR3sl6YblK8fkSEp93QSFsshJ7a5
=qUvo
-----END PGP SIGNATURE-----
 
U

Une Bévue

Tiago Macedo said:
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'
 
T

Tiago Macedo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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:
|
|> 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'
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgfZQEACgkQxFuRTtCTMvJTRACdGGfmyeoeRHHiAk/MkFwgR2e0
uNQAni3YL1Kk3AI6ejqUGASrKw8VE6iW
=6yQL
-----END PGP SIGNATURE-----
 
U

Une Bévue

Tiago Macedo said:
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.

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

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,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top