Search code examples
phpdllimagickuwamp

PHP Imagick UwAmp installation not working


I've been browsing net few days, however I haven't find the solution to my problem yet. So here I am, asking my first stackoverflow question ever: I need to install imagick to my UwAmp local server. My current imagemagick version: ImageMagick-6.8.9-1-vc9-x86 I have Windows 7 x64, but neither x64 version of ImageMagick made my local server run the imagick. In command line, ImageMagick is working OK.

My PHP version: 5.4.31

The extension is listed in UwAmp list of extensions, but when i run PHPinfo there isn't a single word about imagick. My Apache error log doesn't print any error associated with loading problems.

When I run the test file, it prints out: Fatal error: Class 'imagick' not found. I have tried bunch php_imagick.dll files for various versions of PHP, for x64 wamp server, for x86 one etc. The solutions I have found doesn't solve it. Neither do the step-by-step tutorials.

Have you experienced this problem so far? What php_imagick.dll file would you recommend me to try?

Thank you for you help, Michael

EDIT: my UwAmp version is 32 bit


Solution

  • Detailed guide for newbies like me. Took a long time to get it to work.

    I initially followed: http://php.net/manual/en/imagick.installation.php

    but after installation, PHPInfo under imagick shows number of supported formats = 0

    So I followed these steps, clobbered from various sources to get it to work.

    1. Click PHPInfo and check:

      Architecture = x86 or x64

      Thread Safety = yes or no

    2. Download ImageMagick from:

      http://windows.php.net/downloads/pecl/deps/

      In my case I downloaded: ImageMagick-6.9.3-7-vc11-x86.zip

      because the Architecture under PHPInfo is x86

      as for vc11 or vc14

      search google for "visual c++ 11 runtime" or "visual c++ 14 runtime" and install it

    3. Unzip and copy all dlls from the bin subfolder to the Apache bin directory. It's a bunch of CORE_RL_.dll and IM_MOD_RL_.dll plus a few other dlls.

      In my case, I installed UwAmp in C:\UwAmp, so:

      (from zip) bin/*.dll --> C:\UwAmp\bin\apache\bin

    4. Goto:

      http://pecl.php.net/package/imagick

      as of today, latest is 3.4.1 so I went to: http://pecl.php.net/package/imagick/3.4.1/windows

      My PHP version is: 5.6.18, and Thread Safety is Yes from Step #1, so I downloaded:

      5.6 Thread Safe (TS) x86

      and got: php_imagick-3.4.1-5.6-ts-vc11-x86.zip

    5. Unzip and copy "php_imagick.dll" to the php extension folder:

      In my case: php_imagick.dll --> C:\UwAmp\bin\php\php-5.6.18\ext

      Note: this ZIP also contains dlls which other guides says to extract to the extension folder of apache. NO NEED TO DO IT. Step #3 has taken care of it.

    6. Edit "php.ini" and add:

      extension=php_imagick.dll

      or (I placed it at the very end):

      [Imagick]

      extension=php_imagick.dll

      For super newbies: click the edit button in the UwAmp UI, "php_uwamp.ini" will open and edit it. It will be copied to the correct php.ini when UwAmp is restarted. I had trouble at first since there are several php*.ini scattered all over.

    7. Restart Apache

    8. Check PHPInfo scroll to section (or find): imagick
      number of supported formats: 234 (on mine)

      If there is no "imagick" section or "supported format" is 0, something went wrong.

    Hope this helps.

    BTW, the comment to the question by "Gras Double" works, just wish I had found it earlier.