3

PHP 5.3.8

WAMP 2.2.21

ImageMagick 6.6.2 Q16


Fatal error: Class 'Imagick' not found happens no matter what. No matter how many times I...

  1. Install/reinstall different versions of ImageMagick
  2. Try various VC9 builds of php_imagick.dll to 'wamp\bin\php\php5.3.8\ext\'
  3. Have updated my php.ini to include 'extension=php_imagick.dll'
  4. Have restarted my pc and WAMP... I can't count how many times O_o

I also get this error on WAMP startup

enter image description here


The funny thing is that php_imagick.dll shows up in my PHP extensions via the WAMP taskbar

enter image description here

but not in my localhost PHP-Loaded Extensions:

localhost Loaded Extensions


Does anyone have any ideas to why this is happening? Or any suggestions?


SOLUTION: I had to learn the hard way... WAMP 2.2 x32 NOT x64, ImageMagick 6.6.4 Q16 at the greatest.

Terry
  • 675
  • 2
  • 9
  • 21
  • How many php.ini files can you find on this machine? – Cups Oct 24 '12 at 10:17
  • @Cups Hmmm.. didnt't realize that I have 2. I'm gonna update the second php.ini and report back... – Terry Oct 24 '12 at 10:20
  • Watch out, one may be the CLI PHP ini file, so editing that may have unexpected consequences. Have PHP output to you the path of the PHP ini file it is using: inspect the output of phpinfo() onto a webpage (in localhost or whatever). – Cups Oct 24 '12 at 10:25
  • The usual issue with such errors is that either one of imagick's dependencies is missing (does it have any? no idea) or that imagick and/or one of the dependencies are not binary compatible with your PHP (e.g. 32 vs 64 bit compiles). – Jon Oct 24 '12 at 10:29
  • @Cups I updated my second php.ini to incude 'extension=php_imagick.dll' and I now have a new error on WAMP startup... Something about: ...php_imagick.dll - %1 is not a valid Win32 application. I have uploaded an image. – Terry Oct 24 '12 at 10:31
  • @Jon would you have any idea how I could check if my problem is resulting from a x86 vs x64 compile issue? I'm running x86 PHP + WAMP, php_imagick.dll needs a x86 build of ImageMagick to function, whick I'm running. The only thing x64 is my OS. – Terry Oct 24 '12 at 11:05
  • 1
    @Terry: [DependencyWalker](http://www.dependencywalker.com/) can tell you this (and it can do much more to help debug DLL hell!). Load up the DLL and scroll to the bottom of the module list; the DLL you loaded will be in the last line. Look at the "CPU" column. – Jon Oct 24 '12 at 11:17

1 Answers1

1

You are not loading the php_imagick.dll extension.

Check first of all that the file is there and is readable. If it is, then it is not loading because the DLL itself requires some other DLL; this error isn't usually shown by Windows. You will need some tool such as DEPENDS to load php_imagick.dll and see what unresolved externals it contains.

You will probably find that some functions are imported by a library (such as libeay32.dll) that is maybe associated with an extension you did not load, or is in the PHP directory but ought to have been copied into Windows' SYSTEM directory, or maybe uses a different VC runtime (e.g MSVCR90.DLL).

For example, a sample PHP 5.3 php_imagick.dll I found turns out to depend on these two DLL's

CORE_RL_WAND_.DLL
CORE_RL_MAGICK_.DLL

and guess what, CORE_RL_MAGICK is itself depending on other symbols, which explains the problems this guy was experiencing (his solution was maybe a bit more thorough than necessary, but hey, whatever works -- and it might work for you too, but read on)

ImageMagick - "CORE_RL_magick_.dll not found" or how to install RMagick on windows with ruby 1.9.2

Looking into CORE_RL_MAGICK again with DEPENDS turns out a dependence on a specific version of Visual C++ Runtime (and QT too, for some versions of IM), which ties this in the ugly can of worms known as "VC6 against VC9" (e.g. http://www.websiteadministrator.com.au/articles/install_guides/installing_php533_pg2.html ).

Now, what should you do? It depends. Literally; for instead of blindly reinstalling at random until the stars are right (again: it might work. It often does!), I would fire up DEPENDS on the imagick DLL, then on ImageMagick core DLL, and so on, until I hunted down the maze of twisty little dependencies, all alike, that Windows ought to tell you about, but doesn't.

(That's why it's called "DLL Hell").

Community
  • 1
  • 1
LSerni
  • 55,617
  • 10
  • 65
  • 107
  • php_imagick.dll is there and readable, I even double checked ;) I'm pretty sure it doesn't need any other .dll(s) to run. I might be wrong but I have read all and behold tutorials and read forum entry after forum entry and there has never been any mention of any other .dll or placing php_imagick.dll anywhere else but my PHP extensions folder... – Terry Oct 24 '12 at 10:50
  • That might be the most useful answer that i have gotten. Ever. – Terry Oct 24 '12 at 11:17
  • @Iserni Thanks for the help! ps. It's my first time doing this kind of thing, "DLL Hell" is an understatement. – Terry Oct 24 '12 at 12:00
  • You're welcome. You may want to also read the 'DLL Hell' entry on Wikipedia, or the Joel on Software discussion ( http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=2899 ). – LSerni Oct 24 '12 at 14:02