When trying to execute this one line ruby cgi file with mod_ruby:
raise ‘postgres’ unless require ‘postgres’
I get this error to appear in Apache’s error_log
[Mon Sep 01 13:11:45 2003] [error] mod_ruby: error in ruby
/usr/www/apache/ruby/error_handler.rb:1: postgres (RuntimeError)
from /usr/local/lib/ruby/1.8/apache/ruby-run.rb:70:in load' from /usr/local/lib/ruby/1.8/apache/ruby-run.rb:70:in
handler’
When trying to execute this:
require ‘dbi’
conn = DBI.connect(‘dbi:Pg:site_db’,‘www’,’*****’)
I get:
[Mon Sep 01 13:13:11 2003] [error] mod_ruby: error in ruby
/usr/local/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:109:in initialize': uninitialized constant DBI::DBD::Pg::Database::PGError (NameError) from /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:in
new’
from /usr/local/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:in connect' from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:567:in
connect’
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:367:in connect' from /usr/www/apache/ruby/error_handler.rb:7 from /usr/local/lib/ruby/1.8/apache/ruby-run.rb:70:in
load’
from /usr/local/lib/ruby/1.8/apache/ruby-run.rb:70:in `handler’
Presumably because it’s trying and failing to “require ‘postgres’” too.
Both work fine outside of mod_ruby. I thought that maybe it had
something to do with paths and permissions but I can require 'termios’
which is in the same place and has the same permissions as postgres.so.
I’ve also check the libs that postgres links to. They all have rx
permissions for all. Also I have set my safe level to 0 in the httpd.conf.
versions:
ruby-postgres-0.7.1
ruby-dbi-all-0.0.20
(PostgreSQL) 7.3.4
ruby 1.8.0 (2003-08-04) [i686-linux]
mod_ruby-1.0.6
Linux 2.4.20-13.9 #1 Mon May 12 11:03:52 EDT 2003 i686 athlon i386 GNU/Linux
Can anyone give me a hint or lead on this?
TIA,
Michael