How to install ImageMagick PHP extension in Windows

How to install ImageMagick PHP extension in Windows

In this article, I will show you step-by-step how to install ImageMagick PHP extension in Windows. Make sure you follow the steps carefully so that you can successfully install it.

About ImageMagick

Based on imagemagick.org, ImageMagick is a free, open-source software suite, used for editing and manipulating digital images. It can be used to create, edit, compose, or convert bitmap images, and supports a wide range of file formats, including JPEG, PNG, GIF, TIFF, and PDF.

How to install

Step 1

Before you install Imagick, you must first check the PHP version, PHP architecture, and whether your PHP is Thread Safety or not.

You can check this by creating a PHP program that runs the phpinfo() function.

See the image below:

You can see that the PHP version I'm using is version 8.1.10, the architecture is x64, and the thread safety is enabled.

Step 2

After that, you have to download the Imagick package at https://pecl.php.net/package/imagick

Choose a version that is stable and matches your PHP version. In this case, my PHP version is 8.1+.

Choose according to your PHP architecture and thread safety, if your thread safety is enabled then choose thread safe (TS), otherwise choose non-thread safe (NTS).

Step 3

You should also download the Imagick Visual C++ package at https://windows.php.net/downloads/pecl/deps/

Look for a package with the name ImageMagick and select it according to your Windows architecture.

Step 4

Copy the file with the name php_imagick.dll that is in the php_imagick folder that you have downloaded in the second step.

Step 5

Paste the php_imagick.dll file in the ext folder where your PHP folder is located.

In this case, I'm using Laragon.

Step 6

Copy all the files with .dll format in the bin folder belonging to the Imagick Visual C++ folder that you have downloaded in the third step.

Step 7

Paste all the .dll files you copied into your PHP folder.

Step 8

Change the contents of the file named php.ini in the PHP folder by adding extension=imagick and save it.

In some cases, you have to type it like this extension=php_imagick.dll, it depends if the other listed extensions include the .dll format or not.

Step 9

Restart your apache and check whether the imagick extension is installed or not using the phpinfo() function.

If successfully installed then you will find an extension with the name imagick when you run the phpinfo() function.

See the image below

Notes: If you use Laragon, you must check the imagick extension first. The method is by right-clicking on Laragon, select PHP then go to the extensions menu and search for imagick.

Closing

These are the step-by-step how to install ImageMagick PHP extension in Windows. Hopefully the article is useful for you and don't forget to leave a comment on the article.

Did you find this article valuable?

Support Muriz's Blog by becoming a sponsor. Any amount is appreciated!