Select Page

Before downloading the required files to install Imagick, we need to identify your PHP version, PHP compiler version, architecture (x86 or x64), PHP extension build, and whether thread safety is enabled or not. This information can be found by running php -i at the command prompt or running phpinfo().

The various MS VC++ compilers for different version of PHP can be found here: https://wiki.php.net/internals/windows/compiler

If you run phpinfo(), the information you need can be found as shown in the screenshot below.

In our example, we can see we have:

PHP Version 7.4.22
Compiler: Visual C++ 2017
Architecture: x64
PHP Extension Build: VC15
Thread Safety: enabled

You can download imagick here: https://windows.php.net/downloads/pecl/releases/imagick/ and the dependencies here: https://windows.php.net/downloads/pecl/deps/

In this example we want the file named “php_imagick-3.5.1-7.4-ts-vc15-x64.zip” since “7.4,” “ts” (thread safe), “vc15” and “x64” are in the file name. Then we want the dependency file “ImageMagick-7.0.7-11-vc15-x64.zip” since “vc15,” and “x64” are in the file name.

It may be much easier, if instead, you go here to download the 2 files: https://mlocati.github.io/articles/php-windows-imagick.html

We need to make sure a x64 version of Microsoft Visual C++ is installed too.

In Windows, open “Add or Remove Programs” and look for Microsoft Visual C++ Redistributable. The installed versions will be listed there.

Below is a screenshot from Windows 10.

In this case, the Microsoft Visual C++ 2015-2019 Redistributable (x64) installation will do the trick.

You can download Microsoft Visual C++ Redistributable installations from here: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0

Once you downloaded the correct files:

  1. Extract from php_imagick-….zip the php_imagick.dll file, and save it to the ext directory of your PHP installation
  2. Extract the dependencies
    • For PHP 5.x/7.x: Extract from ImageMagick-….zip the DLL files located in the bin folder that start with CORE_RL or IM_MOD_RL or FILTER, and save them to the PHP root directory (where you have php.exe), or to a directory in your PATH variable
    • For PHP 8.x: Extract from php_imagick-….zip the DLL files that start with CORE_RL or IM_MOD_RL or FILTER, and save them to the PHP root directory (where you have php.exe), or to a directory in your PATH variable
  3. Add this line to your php.ini file: extension=php_imagick.dll
  4. Restart Apache

imagick should work now.

If imagick is not working, make sure the directory you put the ImageMagick DLL files in are in the system PATH variable. Even if you put the ImageMagick DLL files in the PHP directory along with php.exe, make sure it is in the PATH.

The screenshot below shows where you edit the system PATH variable. Search for “Edit environment variables” on your system to find it.

To further test if imagick is working, you can find some example code here: https://www.php.net/manual/en/imagick.examples-1.php.

Enjoy!

Owner of Elastic Web Works. Computer Science is my specialty and Web Hosting is my work of art.