Forum: Ruby on Rails Setting environment variable for Rails app?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
225614451dc9aee33be11e0f6876c18b?d=identicon&s=25 Raymond Brigleb (Guest)
on 2006-03-12 16:58
(Received via mailing list)
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:

LD_LIBRARY_PATH="/usr/local/lib"

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?
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-12 18:45
(Received via mailing list)
I think you can do it in environment.rb, you just didn't do it the right
way.

ENV['LD_LIBRARY_PATH'] = '/usr/local/lib'

Pat
65c04c5dc6aa662abdd70275b024dbcc?d=identicon&s=25 Raymond Brigleb (Guest)
on 2006-03-13 17:29
(Received via mailing list)
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
application!
This topic is locked and can not be replied to.