How to install ImageMagick and php extension Imagick on Debian 6.0 + DirectAdmin?

After few months I want to install ImageMagick and Imagick on new server and again digging how to do this. To avoid this next time I wrote those post.

My config is: Debian 6.0, OpenVZ, DirectAdmin, php as php-fpm.

So, first install ImageMagick:

 apt-get install imagemagick libmagickwand-dev

To check version installed:

convert -version

Install php extension – Imagick. Check on http://pecl.php.net/package/imagick latest Imagick stable version and (if you need) adjust code below. Adjust path to your php config too. (line 4 and 5).

wget http://pecl.php.net/get/imagick-3.1.2.tgz
tar -zxf imagick-3.1.2.tgz
cd imagick-3.1.2
/usr/local/php55/bin/phpize
./configure --with-php-config=/usr/local/php55/bin/php-config
make
make install

Now add to your php.ini (in my case /usr/local/php55/lib/php.ini):

extension=imagick.so

My config DirectAdmin / php is php-fpm so I restart php-fpm process:

service php-fpm55 restart

After this check phpinfo and … I see section Imagick – it’s exist! Success 🙂

P.S. On my server I have two PHP versions, so I compile to 5.4 and to 5.5. In this case remember to remove folder imagick-3.1.2 and extract fresh copy, adjust compile code to another php version. Of course if you need Imagick in two php versions.

Have a nice day 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *