# Erb - erubis problems

**URL:** <https://www.ruby-forum.com/t/erb-erubis-problems/115877>\
**Category:** Ruby\
**Created:** [September 29, 2007, 6:43pm UTC](https://www.ruby-forum.com/t/erb-erubis-problems/115877 "2007-09-29T18:43:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wibblecp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/0ea827/32.png) [@wibblecp](https://www.ruby-forum.com/u/wibblecp)\
**Post date:** [September 29, 2007, 6:43pm UTC](https://www.ruby-forum.com/t/erb-erubis-problems/115877/1 "2007-09-29T18:43:33Z")

</div>

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:in`result’  
[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:in`handler’

* * *

## 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
