Problem loading files in Ruby CGI scripts

This is not a Ruby problem as such, but I’m hoping someone will have
come across this problem before and can advise.

I have a basic CGI script, that loads a YAML file and prints out HTML
and a few calculated results. The script works fine when I run it from
the command line, but (no surprise!) I have problems when trying to
access it from a browser. The error message in the APache log
(abbreviated) is " No such file or directory -
/usr/local/lib/ruby/1.8/sparc-solaris2.9/stringio.so (LoadError)
from /usr/local/lib/ruby/1.8/yaml.rb:9"

I guess this must be something to do with permissions, or environment,
because the file referred to does exist. Broadly speaking, from a few
basic tests, it seems that none of the ‘requires’ are working.

Any ideas?

thanks in advance

Only some obvious ones. Is your environment set up correctly? Does the
Apache uid have access to those files? Are you running Apache in a
chroot
jail?

On 5/15/07, Toby R. [email protected] wrote:

from /usr/local/lib/ruby/1.8/yaml.rb:9"
Posted via http://www.ruby-forum.com/.


“Hey brother christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

Glen H. wrote:

Only some obvious ones. Is your environment set up correctly? Does the
Apache uid have access to those files? Are you running Apache in a
chroot
jail?

The file permissions seem OK (all can be read by anybody). I don’t know
about a chroot jail (I’m not the sys admin). As far as environment is
concerned I must admit I don’t know how to check or alter that - can you
point me in the right direction? Thanks again.

It sounds like your environment is probably okay, you said things work
from
the command line. However if Apache is running chroot then it is
possible
it can’t get to files on the regular filesystem. Then again the error
message you are getting is coming from yaml.rb which it seems to find
without any trouble.

I suppose it could be an ACL type issue although I haven’t used solaris
in
years and don’t know what equivalent they have.

I’m afraid without seeing the machine I can’t be of much more help. My
suggestion would be to see if the sys admin can help you out.

Sorry.

On 5/15/07, Toby R. [email protected] wrote:

point me in the right direction? Thanks again.


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


“Hey brother christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

Problem solved - my sys admin sorted me out with an .htaccess file,
which for the record is:

SetEnv LD_LIBRARY_PATH
/usr/local/lib:/usr/sfw/lib:/net/dante-sw/lib:/usr/ccs/lib:/usr/lib:/lib
SetEnv LD_RUN_PATH
/usr/local/lib:/usr/sfw/lib:/net/dante-sw/lib:/usr/ccs/lib:/usr/lib:/lib

and that did the trick!