Erb - erubis problems

Hi all, I have some problems using erb(o erubis) + cgi
I am able to use single rb files or rhtml, but when I try to use a
structure
like that:

file.rb+file.eruby

I have an internal server error (500)
I know, these problems are really by newbie.

I show you my files.


file.rb

#!/usr/bin/ruby
require ‘rubygems’
require ‘erubis’
input = File.read(‘file.eruby’)
eruby = Erubis::Eruby.new(input, :trim=>false)

list = [‘aaa’, ‘bbb’, ‘ccc’]
puts eruby.result(binding()) ## using eruby.evaluate(…)


file.eruby

    <% for item in list %>
  • <%= item %>
  • <% end %>

opening file.rb in my browser (in the shell it works fine, showing me
the
html code) , apache server responds to:

[error] mod_ruby: error in ruby
[error] mod_ruby:
/usr/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:62:in
eval': Insecure operation - eval (SecurityError) [error] mod_ruby: from /usr/lib/ruby/gems/1.8/gems/erubis-2.4.1/lib/erubis/evaluator.rb:62:inresult’
[error] mod_ruby: from /home/indaco/public_html/file.rb:12
[error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in
load' [error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:inhandler’


My httpd.conf is like:

ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/

UserDir public_html

<Directory /home/indaco/public_html/cgi-bin/>
Options ExecCGI
SetHandler cgi-script

<Directory /home/indaco/public_html/>
Options ExecCGI
SetHandler cgi-script
AddHandler cgi-script .rb .rbx .cgi .pl

If the ruby module is installed, this will be enabled.

# # for Apache::RubyRun RubyRequire apache/ruby-run # # for Apache::ERubyRun RubyRequire apache/eruby-run # # for Apache::ERbRun RubyRequire apache/erb-run # # for debug RubyRequire auto-reload

exec files under /ruby as ruby scripts.

<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI

#

# handle files under /eruby as eRuby files by eruby.

<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

# handle files under /erb as eRuby files by ERb.

<Location /erb>
SetHandler ruby-object
RubyHandler Apache::ERbRun.instance

exec *.rb as ruby scripts.

<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

exec *.rbx as ruby scripts.

<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

# handle *.rhtml as eruby files.

<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

Please help me in some way!

Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs