ImageMagick not working with Coldfusion and cfexecute

Oct 16, 2006
I updated our Redhat server with the latest version of ImageMagick 6.2.9-8 a few days ago. We have 2 servers and the install from source seemed to work on both of them. I was able to run the test command the source install says to run.
/usr/local/bin/convert logo: logo.gif

But when I tried running the convert command through the cfexecute tag to resize an image, it wasn't doing anything on one of the servers, but working find on the other one.

The cfexecute command was doing this:

<CFEXECUTE NAME="/usr/local/bin/convert" ARGUMENTS='-resize 40x #thumb_filename# #thumb_filename#' TIMEOUT="60">
</CFEXECUTE>


I looked at the image file and it seemed to access the file and write too it, because it wouldn't change the size.

Again, remember that this worked on one server and not the other and both of these servers have nearly identical installations, with the same versions of Coldfusion and all hotfixes installed. The previous version of ImageMagick 5.5.6 was working fine on both servers. Unfortunately, I couldn't back out of the installation, because I didn't have the original source files and the ImageMagick website didn't have them either.

Anyway, after working on this problem intermittently for a few days, I kept running across the problem of the library path for ImageMagick not being included in the servers path.

I did leave something out in the beginning here. When I first ran convert from the command line, I had to add this to the /etc/profile file to make it work. For some reason I didn't have to do this on the other server. For /etc/profile I had to add the following :

LD_LIBRARY_PATH=/usr/local/lib
PATH=$PATH:/usr/local/lib


And I also added LD_LIBRARY_PATH, to the end of the export line that was already there:

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC LD_LIBRARY_PATH



So, after thinking a bit, i figured that Coldfusion isn't looking at /etc/profile. So I looked at the user Coldfusion was running as, let's use XXX for my example, and I added the same LD_LIBRARY_PATH and PATH statements as above to XXX's /home/XXX/.bash_profile file.

I restarted Coldfusion and this still didn't help.

Then I decided to look at the Coldfusion start script. I found the line where if your OS is Linux, it assigns a LD_LIBRARY_PATH variable and exports it. So I added /usr/local/lib to the end of the LD_LIBRARY_PATH variable, restarted Coldfusion and walla!!! My image was converting using the new version of ImageMagick on both servers.

Here is how the LD_LIBRARY_PATH in the Coldfusion start script looked:

Linux)
                OS=Linux
                LD_LIBRARY_PATH="$CF_DIR/lib:$CF_DIR/lib/_ilnx21/bin:/usr/local/lib"
                CFSTART='su $RUNTIME_USER -s /bin/sh -c "export PATH=$PATH:$CF_DIR/runtime/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; cd $C
F_DIR/runtime/bin; nohup $CF_DIR/bin/cfusion -autorestart -start default &"'



Maybe someone out there can explain to me why 2 nearly identical installations were not working identically. Otherwise, I am happy to say that ImageMagick is working again.

Comments

New Comment