Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get imagick running on PHP 5.4.3 at Windows x64

I have Windows 7 64 bits, PHP 5.4.3 installed through WAMP 2.2 and imagick (ImageMagick-6.8.3-9-Q16-x64-dll.exe). I tried to use the php's dll of imagick from a lot of sources but all of them give this error in apache_error.log:

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0

Any thoughts on how to solve this?

like image 976
Frederico Schardong Avatar asked Mar 16 '13 04:03

Frederico Schardong


3 Answers

perhaps this can help you: step-by-step instructions for installing IMAGEMAGICK on WAMP? and

http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/

"Just to make things clear, all the PHP dll files (librarires) are 32 bit, so if your system is 64 bit and you will still need to download and operate 32 bit ImageMagick, Apache, etc."

like image 65
an_animal Avatar answered Sep 30 '22 22:09

an_animal


I went through the same pain. Win64+php-x86. It ended up being something relatively simple to fix - it is all about paths.

I first had installed the full ImageMagic-x64, then eventually the extension. I later noticed that installer had appended ImageMagic in the beginning of the PATH. Just in case I tried with the x86 version and got different errors about missing DLLs.

So, just in case I uninstalled ImageMagic completely and cleaned up all references to it from the environment (it was in the PATH and MAGICK_HOME).

Then I installed just the extension (in my case from http://windows.php.net/downloads/pecl/releases/imagick/3.1.2/ I got php_imagick-3.1.2-5.4-nts-vc9-x86.zip) and unpacked it in the ext folder.

The revelation came after I tried to run this from the command prompt: php -i and got an error that it could not find CORE_RL_wand_.dll - but I did see it in the ext folder!

Adding C:\Progra~2\PHP\EXT at the end of the PATH environment variable solved it (after making sure that there are no other DLLs interfering).

Note: I used the 8.3 path to "C:\Program Files (x86)\php\ext" - just in case as I've seen PHP being sometimes picky and unable to resolve paths with spaces in them.

Also - after messing up with the PATH you may have to reboot the PC - in my case it worked from a command prompt right away, but IIS had a cached (older) path.

In conclusion: I suspect the PHP extension relies on some DLLs (which it delivers as part of the ZIP) but the same ones are also part of the standard ImageMagick installation, except that the two are not exactly the same - if you happen to be loading the wrong ones fun things happen...

like image 31
Vladimir Strinski Avatar answered Sep 30 '22 22:09

Vladimir Strinski


For a 64bit WAMP (PHP 5.4.x, PHP 5.4.12 thread safe in my case) a working combination is the following:

ImageMagick-6.8.7-8-Q16-x64-dll.exe or possibly latest Q16/x64/DLL from here: Link

and php_imagick-svn20120508-5.4-VC9-x64 from here: http://www.mediafire.com/php-win64-extensions

like image 22
guntars Avatar answered Sep 30 '22 21:09

guntars