How to install Imagick PHP extension in Windows
Tags: imagick, php, tutorial, windows
Published: 2023-11-30 07:23:01

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.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:
![PHP Version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nruhv81cb4938ndhjh7a.png) 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
![PHP PECL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vp0wu39m1bg2jvzkdcrj.png) Choose a version that is stable and matches your PHP version. In this case, my PHP version is 8.1+.
![Imagick for Windows](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usa61afkp6w5taedbilv.png)

**Step 3**
You should also download the Imagick Visual C++ package at https://windows.php.net/downloads/pecl/deps
![Windows PHP PECL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbas41wgetar3ht28pct.png) 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.
![PHP Folder Ext](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chxhkxyvfbzf0mfeoggh.png) 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.
![PHP Folder](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvvcwr81f677ilh7rbwn.png)

**Step 8**
Change the contents of the file named **php.ini** in the PHP folder by adding `extension=imagick` and save it.
![php.ini](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zbi0nu207tlw1gxq3use.png) 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:
![php info()](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bhf4k5xgkdqcrordm2lp.png) 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.