Imagick php windows

ABS picture ABS · Aug 22, 2013 · Viewed 26k times · Source

I am trying to use iMagick in Symfony2.

I am using PHP 5.4.16 and all i have done :

1-Copy php_imagick_nts.dll from php5-4 directory from the extracted http://valokuva.org/~mikko/imagick-php54-php53.tgz to php/ext .

2-Rename it to php_imagick.dll and add the “extension=php_imagick.dll” to php.ini

3-Create a page like this :

<?php 
    $a = new Imagick();
?>

but i receive this :

Fatal error: Class ‘Imagick’ not found in C:\xampp\htdocs\info.php

When I tried to use this in a symfony controller, the error occur again:

FatalErrorException: Error: Class 'Imagick' not found

Unfortunately the details about imagick extension not appear in output of "phpinfo()"

Is this version is incompatible with PHP 5.4.16 ?! If yes,what version i must use? Where? Thank for any help...

Answer

fmstoun picture fmstoun · Dec 15, 2013

I spent many hours trying to make Imagick work, finally I got it.

My installation instructions

  1. Install WAMP 32bit (even if you running 64bit system you must use 32bit version of WAMP)
  2. Install ImageMagick to C:/imagemagick, use this file: https://www.dropbox.com/s/i2mhrhd7sp0ilzk/ImageMagick-6.8.0-3-Q16-windows-dll.exe
  3. Put DLL with Imagick into extension folder of PHP, e.g. D:\wamp32\bin\php\php5.4.16\ext, I used this file: https://www.dropbox.com/s/ayankf850l08rm2/php_imagick.dll
  4. In php.ini put line "SetEnv MAGICK_HOME C:/imagemagick" without quotes
  5. Better restart PC

I use Wamp 2.4, PHP 5.4.16, Apache 2.4.4, ImageMagick 6.8.0-3 2012-10-24 Q16, Imagick 3.1.0RC2 - all 32bit, OS Win8 64bit

Now it should work and you should see Imagick extension loaded in phpinfo.

I tried a lot of versions of ImageMagick, but newer versions didn't work, 6.8.0-3-Q16-windows-dll works fine.

Symfony2

In Symfony2 use Imagick like this:

$im = new \Imagick('image.jpg');