How to get Phusion Passenger and ImageMagick to work together?
For Studio Gallery, I want people to have the ability to upload avatars for the clients that they create. I am using the Paperclip plug-in for this and when running the app via script/server this works great. I installed ImageMagick and Paperclip is able to find it since all the right paths are set in my .bash_profile file.
The problem is that I can’t get Paperclip or ImageMagick to work when running the app via Passenger. I have added the following lines to my /etc/profile file:
#ImageMagick export MAGICK_HOME="/usr/local/ImageMagick-6.4.1" export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib" export PATH=$MAGICK_HOME/bin:/usr/bin:$PATH
But so far, it seems that Apache or Passenger is unable to find ImageMagick. Anyone have any ideas?
If you’re running passenger/apache with a specific user account, have you verified it has the proper access to /usr/local/ImageMagick and /tmp (since it create temporary files over there).
Just a suggestion, since similar stuff happened to me running PaperClip.
HTH.
The problem is that Passenger is not setting environment variables when launching Ruby processes.
You can use my workaround to set necessary environment variables when using Passenger.
The problem is that Passenger is not setting environment variables (that you set in /etc/profile) for launched Ruby processes.
You can use my workaround to set necessary environment variables when using Passenger mod_rails.
I have write post (Spanish) for this issue in my blog
Cool, now if I only spoke Spanish
I was having this same problem with phusion passenger (mod_rails) and the paperclip plugin with ImageMagick. I tried the various solutions found on the web involving changing environment variables, but to no avail.
I originally installed ImageScience via source on slicehost. Then after uninstalling that by doing sudo make uninstall, I reinstalled by doing:
sudo aptitude install imagemagick librmagick-ruby1.8 librmagick-ruby-doc libfreetype6-dev xml-core -y
Then I restarted the server and it worked. Craziness.
Were you able to solve this? There is a thread in the passenger google group.
http://tinyurl.com/66emex
if RAILS_ENV == “development”
Paperclip.options[:image_magick_path] = ‘/usr/local/’
end
in an initializer was their solution. I haven’t gotten this to work.
mp