Class ‘Imagick’ not found? Install ImageMagick on Windows XP with Apache

I recently had a lot of issues installing Image Magick on my local development PC. So I thought I’d share my method of getting it working.
When I tries to create a watermark, I received the error message “Class ‘Imagick’ not found”.

Installing Image Magick

Installing Image Magick on Windows XP (Using PHP version 5.2.x)

Firstly, run phpinfo() on your local web server and search for “imagick”.

You should be able to tell if ImageMagick is already installed on your local server by the results you find here.

Now you need to download and install the ImageMagick package on your PC.

Visit http://www.imagemagick.org/download/binaries/ and seek the ImageMagick-6.5.8-7-Q16-windows-dll.exe to grab the download.

Install the executable somewhere logical. I put mine in C:\Program Files\ImageMagick-6.5.2-Q16

Add the DLL to PHP

Now you need to add the DLL which is required by PHP.

It is available here: http://valokuva.org/outside-blog-content/imagick-windows-builds/

N.b. The difference between Q8 and Q16 is that Q8 uses half the resources of Q16, however, Q16 is more precise in its computations. The Q8 version scales 16-bit images to 8-bit.

Rename the DLL to php_imagick.dll and add it to the (PHP folder)/extension directory.

Edit your php.ini file

Now edit your php.ini file. Make sure you are editing the correct php.ini file. Depending on your usage you may need ht eini file in the Apache folder for web work or the PHP folder for Command line work.

Add the new extension:
“extension=php_imagick.dll” to PHP.ini

Restart Apache

Now restart your apache server.

Check your phpinfo() again and look for imagick.

There should now been a ‘imagick’ section in your phpinfo() document.

Try your PHP script again, it should now work as expected.

Leave a Reply