Point imagick to location other than /usr/bin
I'm trying to compile the imagick extension for Heroku, but I need it to look in the /app/bin folder for ImageMagick rather than the /usr/bin/ folder. I've used as much google-fu as I have, but I can't figure out how to build the imagick.so extension and have it point to a different folder.
From PHP, if I do shell_exec("which convert") it echoes the /app/bin version, but when I do Imagick::getVersion() it points to the /usr/bin/ version. This makes me think it's an issue in the extension.
I haven't ever had to make my own extension from source, so that could definitely be part of the reason. Anything you could do to point me in the right direction would be helpful.
Try with a php.ini file in the webroot, with the following contents:
You may have the wrong end of the stick. You don't compile the Imagick extension against the Image Magick executables but against the Image Magick libraries. i.e. if you're installing Image Magick through a package manager, you should be installing "ImageMagick-devel" not "ImageMagick"
You can then set the directory that Imagick should look for the Image Magick libraries for with the setting:
./configure --libdir=/usr/lib64 --with-php-config=/usr/local/bin/php-config
Or similar depending on where the libraries are installed, and then call make.
However if you're already compiling Imagick you might as well as also compile Image Magick from source.
If I was standing behind you, this would probably be solvable in 5 minutes. I suggest:
1) Find where the Imagick libraries actually are on your system - in particular find the libMagickWand-6.Q16.so file.
2) Make sure you're copying the Image Magick libraries that you want to use to the live server as well as the Imagick library, unless you're statically compiling it (which you probably aren't).
3) Rename the lib that you don't want it to be compiled against. See if compiling Imagick picks the right version up then.
4) Debug the ./configure script for Imagick - you can print stuff out like AC_MSG_RESULT(libs before $DEBUG_LIBS) as I had to do for one issue: https://github.com/mkoppanen/imagick/issues/8 and ensure it's picking the right version up when compiling.
5) Raise an issue at https://github.com/mkoppanen/imagick/ and get the Imagick guy to have a look.