Benjam Benjam - 1 year ago 237
PHP Question

Install Imagick for PHP and Apache on Windows

Steps I've taken so far:

  1. I have installed Imagick on my Win7 machine, and it's installed and running properly via command line.

  2. I've extracted the contents of available here into my \PHP\ext directory.

  3. Enabled the imagick.dll in php.ini

  4. Rebooted...

  5. No errors when starting Apache.

  6. I'm still getting the
    Fatal error: Class 'Imagick' not found
    error when I try to run a script that uses Imagick.

Current Versions:

  • Windows 7 x64

  • Apache 2.4.10 x86 VC11 (from Apachelounge)

  • PHP 5.6.3 x86 VC11 TS (from

  • ImageMagick 6.9.0-0 Q16 x86 (from

  • Imagick DLL (from here)

I was running an older version of PHP and had Imagick working fine with that, then I updated PHP (and the Imagick DLLs along with it) and now I can't seem to get it to work.

Looking at
phpinfo( )
, I don't see Imagick listed there, so it doesn't seem to be loading the module at all. Which is weird, because I'm not getting any errors when starting Apache.

I've tried just about every write-up and walkthrough for installing Imagick for PHP on Windows, but they seem to all be written for older versions of PHP.

Can somebody help me get this installed and running? It seems like it's just missing one simple step that I can't seem to figure out. If you need any more info, please ask. I'll get you whatever I can to help.

Answer Source

I have php 5.6 NTS x64 installed on Windows 8.1 pro for my Development System.

EDIT: This procedure worked with Windows 10 pro as well.

I was unable to get Imagick Working with PHP using an older release of ImageMagick as in the accepted answer and it was difficult to find mirrors with the exact safe binaries needed (the binaries on the mirror in the accepted answer downloaded as different versions than listed).

In all of the steps below, be sure to match your PHP architecture (x86/x64 and NTS/TS) to the binary's architecture. If you are using PHP x86 - replace the x64 version of the downloads with the x86 (or 32bit) version. The same applies to Thread-Safe (TS) and Non-Thread-Safe (NTS) versions of PHP.

I finally got it all working by performing the following:

  1. Navigate to and download the current RC DLL (3.3.0RC1). Imgur
  2. Extract php_imagick.dll to D:\php5.6\ext
  3. Extract all CORE_RL_*.dll files to D:\php5.6 - Ensure D:\php5.6 is also added to the PATH of your system environment variables
  4. Add extension = php_imagick.dll to D:\php5.6\php.ini
  5. Restart Apache/PHP Built-In Web Server
  6. Check PHP Info to ensure the module is installed correctly Imgur Note the highlighted ImageMagick version (ImageMagick 6.9.1-2 Q16 x64) and the missing supported formats
  7. Download and install the matching version of ImageMagick to D:\php5.6\bin from - Ensure that the Add Path to Environment Variables option is checked or manually add it Imgur.
  8. Load a command prompt and ensure convert --version displays the correct version Imgur
  9. Delete the previously extracted CORE_RL_*.dll files in D:\php5.6 (they will be loaded via ImageMagick path - otherwise your PHP installation may become unstable with the PECL RC dlls)
  10. Restart Apache/PHP Built-In Web Server
  11. Check PHP Info to ensure module is still installed correctly and is now loading the Imagick supported formats Imgur
  12. Optionally download and install Ghostscript to D:\php5.6\bin to be able to convert PDFs to images from be sure to match the architecture for your installation

I did not need to add MAGICK_HOME for Imagick to work using the PHP Built-In Web Server, but may be required for Apache. Other note is to ensure the user running PHP has permission to execute convert. This should be inherited via D:\php5.6\bin but in case you chose to install to C:\Program Files. you may have issues due to its restricted permissions.

Alternative for Image conversion

As noted in the comments, you can alternatively download the required ImageMagick version dependencies and extract the exe and dll files from within the bin directory directly into your D:\php5.6 directory. The dependencies can be found on PECL website

With the PECL dependencies method there were issues with excluded files needed for PDF conversions using GhostScript.

Special Considerations

Be sure to rearrange your PATH System Environment Variable so that %SystemRoot%\system32\convert.exe does not override the D:\php5.6\bin\convert.exe.

By adding your PHP path to the left of system32, like so: PATH: D:\php5.6\bin;%SystemRoot%\system32;%SystemRoot%;...

This will force your system to look for executable files within D:\php5.6\bin prior to %SystemRoot%\system32

Replace D:\php5.6\bin\convert.exe with the path to where you installed ImageMagick or the path to where convert.exe is located

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download