Setting environment variables for cgi/fcgi scripts
Posted by: scottd72
Posted on: 2006-12-07 15:22:00
Hi --
I'm having trouble getting shared libraries to load in my Ruby CGI scripts, and I'm pretty sure it's because the LD_LIBRARY_PATH variable is getting stripped out of the environment by the web server for "safety" reasons. (Everything works just fine if I run things as stand-alone scripts without the right environment variables.) Unfortunately, setting ENV["LD_LIBRARY_PATH"] in the Ruby process itself before attempting to load the shared library appears to be "too late"...it needs the environment variable set correctly before the Ruby process starts, or it doesn't work at all.
Question: how do I either (1) keep LD_LIBRARY_PATH from getting stripped out -- I'm guessing this is not actually possible without superuser privileges -- or (2) create a wrapper [f]cgi script that sets the enviornment variable correctly before forwarding the request to the "real" [f]cgi script? (Or if there are any other ways of working around this @#$% "security" measure, I'd love to hear them...)
Thanks,
-- Scott