Installing Imagick PECL on Windows

In my fiddling, my Windows workstation serves as a my webserver. While setting up Apache, MySQL and PHP is trivial using WampServer, getting PECL extensions to work can be tricky.

Which package should I download?

Prebuilt packages are available for Windows. (I went with the 32 bit version, even though my OS is 64 bit. I'm pretty sure 64 bit will work, too.)

The setup has two points of attention: installation path and environment variables. I went with a can't-fail path:

C:\img

The Imagick installer will offer to set the environment variable in your path. You'll either want to check this option, or ignore it, as you'll have to manually change it anyway.

Configuring the Windows Enviroment

Now for something the documentation does not mention: setting the MAGICK_HOME value in your environment. ImageMagick requires this variable so it knows where to find all relevant coders.

Open up the control panel, and search for 'PATH'. In the results, select 'Edit the system environment variables'. Select the 'Environment variables...' option, and add a new 'System variable' (the lower list). If you've chosen a different installation path, make sure to replace C:\img with your own path.

Variable: MAGICK_HOME
Value: C:\img\modules\coders

Install the PECL package

Next up, we'll actually install the PECL package. The maintainers have been so kind as to provide a Imagick DLL. If you are using WAMP, like me, make sure to use the Thread Save version. Pick the package that matches your PHP version and the X86/X64 version of ImageMagick you've installed.

From the download, in my case php_imagick-3.1.2-5.5-nts-vc11-x86.zip, grab the php_imagick.dll file, and move it your PHP extention folder:

C:\wamp\bin\php\php5.5.12\ext

The other DLL's, all starting with CORE_RL_*, can be moved into Apache's binary folder:

C:\wamp\bin\apache\apache2.4.9\bin

Finally, activate the extention in your PHP.ini file. Make sure to actually edit the loaded configuration file. (You can check with phpinfo() if you're not sure.)

C:\wamp\bin\apache\apache2.4.9\bin\php.ini

Find the list of extensions, and add Imagick:

extension=php_imagick.dll

Check if everything is OK

Restart Apache, and check phpinfo() again. If all went well, you'll find details on the Imagick installation:

Imagick PECL extension on Windows