How to install the ImageMagick php extension for use on a Windows Server IIS server

If you’re hosting your WordPress site under IIS with PHP7 installed, you probably have the PHP ImageMagick extension that isn’t installed.
To do this, follow the guide…

Download the ImageMagick installer

Visit http://www.imagemagick.org/
Click on “Download” in the menu bar

Then “Windows Binary Releases” in the top links.

Select the “WinXX dynamic at 16-bit-per-pixel component,” make sure you select a dynamic, non-static component. Choose a 32- or 64-bit version depending on the Windows version.

Download the php module for ImageMagick

Go to http://windows.php.net/downloads/pecl/releases/imagick/
Select the highest version that is not a “RC” version (Release Candidate) – currently 3.4.4

Select input for the version of PHP (7.3), x64 , and “NTS” (Non Thread Safe) for IIS. Download and save the ZIP file.

Download the dependencies package for PHP to load/use ImageMagick

Go to http://windows.php.net/downloads/pecl/deps/
Select the “ImageMagick” package with the highest version number and the “vc15” and “x64” versions.

Unlock each of the downloaded files

This may or may not be necessary depending on how you downloaded it, but you should always check and “unlock” downloaded files if necessary.

Check and “unblock” downloaded files if needed.
• Right-click on each file and select Properties from the popup menu
• if the properties dialog shows the text “This file came from another computer and might be blocked to help protect this computer”,
• click the Unblock button
• click OK.

Installing the Imagick Application

Run ImageMagick-7.0.8-59-Q16-HDRI-x64-dll.exe to install it. Accept the license agreement and accept the defaults on each screen in the installation process.

After the installation completes, to test that it was successful, open a command prompt and run the following two commands:

magick wizard: wizard.jpg
magick wizard.jpg win:

This should display an “IMDisplay” window showing a sketch/image of a wizard at an easel creating a Mona Lisa portrait.

Install the dependencies

Unpack the ImageMagick-7.0.7-11-vc15-x64.zip file you downloaded.
Go into the bin directory, copy the files IM-MOD-RL-RL-RL.dll (126 files) in the folder of the installed version of ImageMagick, for example C:\ Program Files\ImageMagick-7.0.8-Q16-HDRI.

Return to the bin directory to copy the core-RL-RL.dll (22 files) files in the folder of the installed version of ImageMagick, such as C:\Program Files\ImageMagick-7.0.8-Q16-HDRI.
On the prompt if you wish to overwrite/rename, select overwrite

Installing the Imagick php extension dll

Decompress the previously downloaded php-imagick-3.4.4-7.3-nts-vc15-x64.zip file.
Copy the file php-imagick.dll in the “ext” folder of the installed version of PHP on the server, such as C:\Program Files\PHP\v7.3\ext.

Don’t copy core-RL-RL files.
In some articles on the web, you’ll see instructions to also copy the CORE-RL files in this kit to replace the ImageMagick folder files, but this is incorrect. The appropriate versions of these files have already been copied previously.

Activation of the PHP extension

Start the IIS Management console and double click on PHP Manager.

Click Turn on or turn off an extension.

Select php-imagick.dll and click to Activate at the top right.

The php extension should be active as below.

Restarting IIS does not seem sufficient to take this extension into account.
You have to restart the machine. This probability is related to the fact that IIS does not recognize the PATH entry in which Imagick was entered during the installation of it.

Test with PHPINFO()

To make sure that the extension has been loaded, check with phpinfo via the IIS management console

The screen below indicates that Imagick has been loaded and is well available in the PHP environment.

Leave a Reply

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