WebFaction
Community site: login faq

How do I install the ImageMagick library along with the imagick PHP PECL extension?

asked 01 Jun '13, 19:12

ryans ♦♦
5.0k93360
accept rate: 43%

edited 01 Jun '13, 19:13

I was under the impression that ImageMagick library for PHP would be available to all users by default. No ?

(01 Oct '15, 11:00) anjanesh

Currently Imagick is not installed by default on our servers. There is an internal ticket for our System Administrators to install it globally on all servers, however there is no ETA as to when that will be done.

(01 Oct '15, 13:52) aaront ♦♦

You should be able to set up ImageMagick with imagick as follows. In this example, I assume "htdocs" for the webapp name. I also assume that you are installing for php5.4:

Installing ImageMagick

mkdir -p $HOME/src
cd $HOME/src
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd ImageMagick-6.8.5-8
./configure --prefix=$HOME --without-perl
make
make install
echo "export PATH=$HOME/bin:\$PATH" >> .bash_profile
source .bash_profile
hash -r

Installing imagick PECL extension

mkdir -p $HOME/src
cd $HOME/src
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar xzvf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2
phpize54
ln -s $HOME/include/ImageMagick-6 $HOME/include/ImageMagick    # configure script wants it here
./configure --with-php-config=/usr/local/bin/php54-config --with-imagick=$HOME
make
mkdir -p $HOME/php54-exts
cp modules/imagick.so $HOME/php54-exts/
ln -s /usr/local/lib/php54/extensions/no-debug-non-zts-20100525/* $HOME/php54-exts/
echo "extension_dir = $HOME/php54-exts" >> $HOME/webapps/htdocs/php.ini
echo "extension = imagick.so" >> $HOME/webapps/htdocs/php.ini

cd $HOME/php54-exts
wget 'http://mirror.ryansanden.com/nomake-0.1.0/bin/x86_64/bootstrap/patchelf'    # This is a 64-bit binary. For 32-bit binary, wget 'http://mirror.ryansanden.com/nomake-0.1.0/bin/i686/bootstrap/patchelf' instead
chmod 755 patchelf
./patchelf --set-rpath "$HOME/lib:" imagick.so
ln -s $HOME/lib/libMagickWand-6.Q16.so.1.0.0 $HOME/lib/libMagickWand.so.2
ln -s $HOME/lib/libMagickCore-6.Q16.so.1.0.0 $HOME/lib/libMagickCore.so.2

A final note: this is a bit of a hack. libMagickWand-6.Q16.so.1.0.0 is not libMagickWand.so.2, and libMagickCore-6.Q16.so.1.0.0 is not libMagickCore.so.2, but symlinking as above was the only way I was able to get phpinfo() to show ImageMagick 6.8.5-8. The imagick.so file explicitly is looking for files named "libMagickWand.so.2" and "libMagickCore.so.2", and if they are not provided, the system versions will be used. You can see the dynamic linking information using the command "ldd $HOME/php54-exts/imagick.so".

As far as I can tell, this still functions correctly, for example with the WordPress ImageMagick Engine and Zenphoto, but no guarantees can be made.

Hope that helps!

permanent link

answered 01 Jun '13, 19:20

ryans ♦♦
5.0k93360
accept rate: 43%

edited 01 Jun '13, 19:25

P.S. if you want to use another version of PHP, say 5.5 or 5.6 make sure you replace every instance of '54' with '55' or '56' etc, paste the commands into a text editor and use search/replace to make sure this is done.

(30 Sep '15, 22:43) johns

I've just used ryans' instructions to install ImageMagick. Incase anybody else is interested, you can install ImageMagick with perl by using the following configure command:

./configure --prefix=$HOME --with-perl --with-perl-options=PREFIX=$HOME

See the ImageMagick advance installation options for more info

Also,there is no need to soft link the libMagickWand-6.Q16.so or libMagickCore-6.Q16.so libs anymore, as the so.2 now already seem to be in $HOME/lib

permanent link

answered 20 Jul '14, 08:05

pjrobertson
4518
accept rate: 0%

edited 20 Jul '14, 08:53

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×11
×10
×2

question asked: 01 Jun '13, 19:12

question was seen: 10,754 times

last updated: 01 Oct '15, 13:52

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM