Setting environment variable for Rails app?


Greetings! I’m trying to set an environment variable in Rails. Why? I
can’t use RMagick unless I do so. I can do it from the shell, run
irb, and then require ‘RMagick’ works. So far so good. But how can I
do this from my Rails application?

I’m on a shared host so I’ve put in a ticket to have something like
this added to httpd.conf:

SetEnv LD_LIBRARY_PATH /usr/local/lib

That would probably fix it. I’ve tried adding it to my .htaccess with
the other settings but it doesn’t seem to work. Restarted the process
and everything. Even tried adding this to environment.rb but nothing:


Is there any way to force this library path in my application? Or am
I stuck waiting for my shared hosting company to figure out and fix
the issue?


I think you can do it in environment.rb, you just didn’t do it the right

ENV[‘LD_LIBRARY_PATH’] = ‘/usr/local/lib’



Thanks, Pat. I’ve tried setting it that way, I’ve tried setting it in
.htaccess, I’ve even got my web host to set it in Apache’s vhost
config for FCGI, which I’m running under.

But I’m still getting “uninitialized constant Magick” as soon as I try
to require ‘RMagick’. Is there anything at all I might still possibly
be missing? Or is this just a lost cause? It seems crazy to me that
the RMagick libraries would be on the server, and accessible to irb if
the variable is exported for the shell, but unusable to my