Running ImageMagick on XAMPP 1.8.3 with Windows 7

大城市里の小女人 提交于 2019-11-27 08:03:32
Chris Stocking

OK. I finally found a combination that works. After MUCH trial and error, I was finally able to get the below combination to work on my machine. Hopefully it works for anyone else who might be struggling with this.

  • OS: Windows 7 64 Bit
  • PHP: 5.5.6
  • XAMPP: 1.8.3
    • Compiler: MSVC11
    • Architecture: x86
  • ImageMagick: ImageMagick-6.7.7-5-Q16-windows-dll (available here)
  • Imagick DLL: PHP5.5.x version from http://www.peewit.fr/imagick/

Note: Once I tried this, Apache started without any error messages. I did not have to restart my computer (just restarted Apache). I do have ImageMagick installed in a directory that has no spaces in the name (as some have suggested that might be a problem with some installs). In my case, I installed it to c:\xampp\imagemagick.

Best of luck to you!

Imagick is a PECL extension and the official windows.php.net site has compiled versions of PECL extensions.

Please download Imagick from: http://windows.php.net/downloads/pecl/releases/imagick/

And download ImageMagick from: http://windows.php.net/downloads/pecl/deps/

Please note, downloading Imagick from one site, and downloading ImageMagick from another site is likely to not work! This is because when Imagick is compiled it uses several settings that vary based on what versions of ImageMagick it is being compiled against.

FYI the maintainer of the Imagick extension recommends not running it inside Apache, but instead to run it as a background task through something like SupervisorD or cron. This is both for security and performance reasons.

After spending many hours trying to get this blasted thing to work (Windows 7, 64-bit), with no success, I decided to look at other systems to see how they handled the problem. What mediawiki did was simply NOT USE the ImageMagick/PHP extension! They call the ImageMagick convert.exe program directly and use the result (see includes/media/Bitmap.php in the mediawiki package).

You can't really blame people for abandoning the PHP extension, since apparently it has to be compiled with the "right" ever-varying compiler and matched at least with apache and ImageMagick builds. What is surprising about the situation is that this problem has been going on for over five years and it still isn't handled.

So my "solution/answer" isn't really one, it basically is to call ImageMagick a different way to avoid the problem, like mediawiki did.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!