From: Coey Minear Date: 2006-07-21T04:50:28+09:00 Subject: Re: Trouble setting LD_LIBRARY_PATH for FastCGI script Chris Gansen writes: > Hello - > > I'm trying to exec a ruby script via FastCGI (on Apache 2.0), and cannot > properly set the env. variable LD_LIBRARY_PATH at run time. > > I've tried adding: > > SetEnv LD_LIBRARY_PATH /path/to/lib > > in a .htaccess file, but to no avail. Perl, however, happily recognizes it. > Setting ENV['LD_LIBRARY_PATH'] does not take effect either. > I set this in Apache's httpd.conf file, in the declaration. You will also want to make sure you declare all the libraries needed. If you just declare "/path/to/lib", the libraries wouldn't necessarily know where to find libraries in /usr/lib, for example. Here is the line I used (on my Solaris system): SetEnv LD_LIBRARY_PATH /usr/lib:/usr/local/lib:/usr/openwin/lib:/usr/local/pgsql/lib (Probably don't really need the /usr/openwin/lib, but...) You would have to restart Apache, but I expect you would have to do that anyways if one could set the same thing in the .htaccess. > In the error_log, I see: > > [Thu Jul 20 11:32:33 2006] [warn] FastCGI: (dynamic) server > "/web/server_root/fcgi-bin/index.fcgi" restarted (pid 11242) > /path/to/ruby_bin/lib/ruby/site_ruby/1.8/i686-linux/fcgi.so: libfcgi.so.0: > cannot open shared object file: No such file or directory - > /path/to/ruby_bin/lib/ruby/site_ruby/1.8/i686-linux/fcgi.so (LoadError) > from > /path/to/ruby_bin/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in > `require' > from /path/to/index.fcgi:23 > > > Strangely, when I execute the fcgi script from the command line, as: > > $ LD_LIBRARY_PATH=/path/to/lib ./index/fcgi > > I receive: > > ./index.fcgi:25: undefined method `each_cgi' for FCGI:Class (NoMethodError) > > Which is particularly vexing. This configuration works on another machine, > where the libraries are not in 'special' places. > > Any advice on how to get Ruby to find the correct library? > > -c- Are you sure you've installed FastCGI on this system? Based on what I see in the log file: 1) The server cannot find libfcgi.so.0, which is installed with FastCGI. Make sure the file is present. 2) You've probably installed ruby-fcgi since it knew about FCGI:Class, but the fcgi.so file would require the libfcgi.so library. Did you copy the ruby libraries over, but not the system libraries? Coey -- Coey Minear Senior Test Engineer (651) 628-2831 coey_minear@securecomputing.com Secure Computing(R) Securing Connections between People, Applications, and Networks(tm) http://www.securecomputing.com NASDAQ: SCUR *** The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any review, dissemination, distribution or copying is strictly prohibited. If you have received this email message in error, please notify the sender by reply email and delete the message and any attachments. ***