Install ImageMagick for PHP/XAMPP on Windows

ImageMagick is a program that allows you to convert, flip, read/write, distort, resize and generally do all sorts of crazy stuff with images. That is does not sound like much if you’ve ever seen Photoshop but it’s a ton if you are trying to code some automatic image generation. The problem is XAMPP does not come with ImageMagick preinstalled so you have to install it yourself. Not only that but you need to get some specific DLL files that need to be installed in your XAMPP before you can do anything with ImageMagick trough PHP. Once you are done you will have the power to use the whole ImageMagick PHP Library. So here we go…

I am using windows 8.1 but your setup should be similar.

I found this great video on how to do it, however the audio is a bit poor so you might want to read the steps below and follow them instead.

 

 

I know the audio is a bit poor so I will do you a favor and list the steps here. Also they are easier to follow if written:

  1. Open http://www.imagemagick.org/script/binary-releases.php#windows  and select the package that fits your php install. Mine is 32 bit and I chose ImageMagick-7.0.2-6-Q8-x86-dll.exe . Install as an Administrator. This will install the ImageMagick software on your computer. We still need to install some more files:
  2. From https://pecl.php.net/package/imagick/3.1.2/windows download the Thread Safe version of the archive for your PHP. Mine is 32 so I chose “5.6 Thread Safe (TS) x86” if you are using 64 bit PHP go with “5.6 Thread Safe (TS) x64
  3. Extract the files into a folder. Take “php_imagick.dll” and put it in your <xampp-folder>/php/ext
  4. Get all the files that start with “CORE_RL_” and end in “_.dll” (CORE_RL_*_.dll) and put them in <xampp-folder>/apache/bin
  5. Use your XAMPP Control Panel to restart Apache.
  6. If you get an error that vcomp110.dll is missing from your computer, go to this page https://www.microsoft.com/en-us/download/details.aspx?id=30679 click the red Download button and choose the appropriate package to install. For 32 bit php choose  “VSU_4\vcredist_x86.exe”, for 64bit – “VSU_4\vcredist_x86.exe”. Install and next time you start Apache the error should be gone.