Apache with Ruby - Gems Issue

I have work on Ubuntu in order, but I can't get it to work on Mac OS-X 10.6.7.

My Apache configuration file has been edited so that it runs any files .rb. The ruby ​​script that I use has require 'rubygems'.

In Ubuntu, I added SetEnv RUBYOPT rubygemsApache to my configuration file, so I don’t even need to use it require 'rubygems'. On my Mac, even when I need rubigems, it cannot load gems.

In IRB, it loads the gems in order, and I can run the script from the OK command line.

My script is in / Library / WebServer / Documents

Apache error log says -

[Mon May 23 18:56:40 2011] [error] [client :: 1] /Library/Ruby/Gems/1.8/gems/dbi-0.4.5/lib/dbi/utils/date.rb:57: undefined method `deprecate 'for DBI :: Date: Class (NoMethodError)
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Gems/1.8/gems/dbi-0.4.5/lib/dbi/utils.rb:56
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:50
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:58:in `gem_original_require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/Ruby/Site/1.8/rubygems/custom_require.rb:58:in `require '
[Mon May 23 18:56:40 2011] [error] [client :: 1] \ tfrom /Library/WebServer/Documents/ruby_file.rb:6

I thought adding require 'rubygems'means gemstone tracks will be loaded. Does anyone know why Apache cannot load gems?

+3
source share
1 answer

I solved this without putting require 'dbi'in my script. Use require 'sqlite3'enough.

0
source

All Articles