Tuesday, January 26, 2016

Install Imagick for XAMPP on Windows and get it running


Hello!

Today i want to show you how to install Imagick for your XAMPP portable server and get it running, because this is a bit tricky and not very well documented.

I will show you my working solution - if you have better approaches please write it down below on the comments.

Installation and configuration

To get Imagick running under Apache you first have to download a bundle of so called wrapper files or PECL for integration in PHP needed for the access to the real ImageMagick files.

I got XAMPP 5.6.15 (x86) on Windows 7 - for this i used Imagick 3.4.0RC5 from https://pecl.php.net/package/imagick/ - direct link is https://pecl.php.net/package/imagick/3.4.0RC5/windows.

There you need the binaries PHP 5.6 Thread Safe (TS) x86 or direct link - http://windows.php.net/downloads/pecl/releases/imagick/3.4.0RC5/php_imagick-3.4.0rc5-5.6-ts-vc11-x86.zip.  (or see External Links section down below)

Extract the file php_imagick.dll to your /xampp/php/ext directory.Now you have to register the dll to your php.ini - open /xampp/php/php.ini - search for extension and add a new row extension=php_imagick.dll

Reopen zip-file and extract all dll's like CORE_RL_*.dll to your /xampp/ root directory.

When you now restart Apache and look into you phpinfo() you should find a section Imagick - then the library is successfully loaded! But - if you watch in detail - the number of supported images is zero. You can also see Imagick is buildt against a very old ImageMagick Library version 6.9.1-2 Q16 x86 2015-04-14.

Download the oldest stable version of ImageMagick you can find on ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/ - but notice, it should contain the terms Q16 and x86. (or see External Links section down below). Now install the ImageMagick package. After installation open installation folder and copy all files named CORE_RL_*.dll to your /xampp/ folder - but, dont replace files, just copy the files which are not existant. Then copy all Codec-Dll's from i.e. C:\Program Files (x86)\ImageMagick-6.9.3-Q16\modules\coders to your /xampp/ directory. Reboot/start Apache - now Imagick should run with all formats.


Good luck!

Note: because of installing ImageMagick local it's not portable!

Comprehensive Installation TODO List:
  1. Download latest PECL Imagick Zip file
  2. Extract php_imagick.dll to php/ext directory
  3. Register Dll in php.ini as extension
  4. Extract CORE*.dll to xampp directory
  5. Start apache and look in phpinfo(), which version Imagick is buildt against
  6. Download the oldest possible compatible version from ImageMagick website - download a version with Q16 and x86
  7. Install ImageMagick
  8. Copy all CORE_RL_*.dll from ImageMagick*/ to xampp folder but don't replace, just copy non existant files
  9. Copy all Dll's from ImageMagick*/modules/coders to your xampp folder
  10. Start Apache and look in phpinfo() if Imagick is loaded and supported images are loaded

External Links:
http://www.megafileupload.com/en7s/php_imagick-3.4.0rc5-5.6-ts-vc11-x86.zip
http://www.megafileupload.com/izgO/ImageMagick-6.9.3-2-Q16-x86-dll.exe