Strange Camping Error

I’m trying to deploy a simple Camping application using plain old CGI.
When I access the page I get a 500 error and in my logs it says:
[Wed Feb 14 17:18:46 2007] [error] [client 70.105.220.65] fortunes.cgi:
4:in `require’: no such file to load – camping (LoadError)

This makes it seem like Camping isn’t installed, but if I do gem list
Camping is shown on the list. WIth that being said, I fired up IRB,
and entered require ‘camping’ which resulted in a “no such file to
load” error. After playing around with it a bit I noticed that if I
did require ‘rubygems’ and then require ‘camping’ the files would
load.

Anyone have any ideas as to why my application can’t load Camping?
Thanks

Chris C. wrote:

On 2/14/07, Tony C. [email protected] wrote:

load.

Anyone have any ideas as to why my application can’t load Camping?
Thanks


Posted via http://www.ruby-forum.com/.

Hi Tony,
As you discovered in irb you must require ‘rubygems’ first, and you
need to do that in your script too. require ‘rubygems’ rewrites the
require method to search your gems too.

Thanks for the explanation. I have require ‘rubygems’ before require
‘camping’ in my application, but I’m still getting an error:
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] no such file
to load – camping
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] (
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] LoadError
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] )

On 2/14/07, Tony C. [email protected] wrote:

load.

Anyone have any ideas as to why my application can’t load Camping?
Thanks


Posted via http://www.ruby-forum.com/.

Hi Tony,
As you discovered in irb you must require ‘rubygems’ first, and you
need to do that in your script too. require ‘rubygems’ rewrites the
require method to search your gems too.

On 2/15/07, Tony C. [email protected] wrote:

Thanks for the explanation. I have require ‘rubygems’ before require
‘camping’ in my application, but I’m still getting an error:
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] no such file
to load – camping
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] (
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] LoadError
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] )

Sometimes, these sorts of problems are created by the fact that the
webserver is actually running as a different user that doesn’t have
access to the gems, etc… Depending on where/how the gems are
installed, and what user the webserver acts as, I’ve seen things like
this in the past.

Not a real solid answer, but maybe something to go on.

hth,
-Harold

Are you doing a require or require_gem (or properly, gem)?

–Jeremy

On 2/14/07, Tony C. [email protected] wrote:

[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] LoadError
[Wed Feb 14 18:58:48 2007] [error] [client 70.105.220.65] )


Posted via http://www.ruby-forum.com/.


http://www.jeremymcanally.com/

My free Ruby e-book:
http://www.humblelittlerubybook.com/book/

My blogs:

http://www.rubyinpractice.com/

Jeremy McAnally wrote:

Are you doing a require or require_gem (or properly, gem)?

–Jeremy

I’m doing require.

First I have require ‘rubygems’, and on the next line is require
‘camping’.

On 2/15/07, Tony C. [email protected] wrote:

Alright here’s an update.
I was able to get iRB to find the Camping gem. I can also run the
Camping application in a shell and it runs fine. However, Apache is
still giving me the same strange error saying it’s can’t find Camping.
Anyone have any suggestions?

Do you know if Apache’s definitely using the same Ruby? Does the
Apache user have permissions for the gems directory? How did you get
irb to find the gem so you can run it in the shell?

Alright here’s an update.
I was able to get iRB to find the Camping gem. I can also run the
Camping application in a shell and it runs fine. However, Apache is
still giving me the same strange error saying it’s can’t find Camping.
Anyone have any suggestions?

Giles B. wrote:

Do you know if Apache’s definitely using the same Ruby? Does the
Apache user have permissions for the gems directory? How did you get
irb to find the gem so you can run it in the shell?

I’m 100% that Apache is using the same Ruby, and the Apache user is the
same user that I was using in the shell, so it should have access to the
gems. I can load other gems with the CGI script (I.E. rails,
activerecord, etc.), but camping does not want to load. I tried
reinstalling the gems multiple times, and it still doesn’t work. As for
irb, I simply ran require ‘rubygems’ and then require ‘camping’ and it
worked flawlessly.

Thanks for the suggestions,
Tony