php 在 Windows 7 的 XAMPP 1.8.3 上运行 ImageMagick
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21055786/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running ImageMagick on XAMPP 1.8.3 with Windows 7
提问by Chris Stocking
I have been trying for hours to get ImageMagick working on my localhost (running XAMPP 1.8.3 on Windows 7). I have checked and tried literally every solution that I can find on this website, and dozens of others. Nothing works. No matter what combination of ImageMagick builds and imagick DLLs I try, I always get some kind of "can't find dll" error when I try to start Apache (the specific message varies based on what combination I'm trying, but it's always some sort of missing DLL message). Can anyone just give me a (moderately recent) combination of XAMPP/ImageMagick/Imagick that works?
我已经尝试了几个小时让 ImageMagick 在我的本地主机上工作(在 Windows 7 上运行 XAMPP 1.8.3)。我已经检查并尝试了我可以在这个网站上找到的每一个解决方案,以及其他几十个。什么都行不通。无论我尝试使用 ImageMagick 构建和 imagick DLL 的哪种组合,当我尝试启动 Apache 时,我总是会遇到某种“找不到 dll”错误(具体消息因我尝试的组合而异,但它总是某种丢失的 DLL 消息)。任何人都可以给我一个(最近的)XAMPP/ImageMagick/Imagick 的有效组合吗?
回答by Chris Stocking
OK. I finally found a combination that works. After MUCHtrial 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/
- 操作系统:Windows 7 64 位
- PHP:5.5.6
- XAMPP:1.8.3
- 编译器:MSVC11
- 架构:x86
- ImageMagick:ImageMagick-6.7.7-5-Q16-windows-dll(可在此处获得)
- Imagick DLL:来自http://www.peewit.fr/imagick/ 的PHP5.5.x 版本
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.
注意:一旦我尝试了这个,Apache 启动时没有任何错误消息。我不必重新启动计算机(只需重新启动 Apache)。我确实将 ImageMagick 安装在名称中没有空格的目录中(因为有些人认为这可能是某些安装的问题)。就我而言,我将它安装到 c:\xampp\imagemagick。
Best of luck to you!
祝你好运!
回答by Danack
Imagick is a PECL extension and the official windows.php.netsite has compiled versions of PECL extensions.
Imagick 是一个 PECL 扩展,官方 windows.php.net站点已经编译了 PECL 扩展的版本。
Please download Imagick from: http://windows.php.net/downloads/pecl/releases/imagick/
请从以下位置下载 Imagick:http: //windows.php.net/downloads/pecl/releases/imagick/
And download ImageMagick from: http://windows.php.net/downloads/pecl/deps/
并从以下位置下载 ImageMagick: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.
请注意,从一个站点下载 Imagick,从另一个站点下载 ImageMagick 可能无法正常工作!这是因为在编译 Imagick 时,它使用多种设置,这些设置因编译所针对的 ImageMagick 版本而异。
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.
仅供参考,Imagick 扩展的维护者建议不要在 Apache 中运行它,而是通过 SupervisorD 或 cron 之类的东西将其作为后台任务运行。这是出于安全和性能原因。
回答by Mr Ed
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).
在花了很多时间试图让这个该死的东西(Windows 7,64 位)正常工作后,没有成功,我决定查看其他系统,看看它们是如何处理问题的。mediawiki 所做的只是不使用 ImageMagick/PHP 扩展!他们直接调用ImageMagick convert.exe 程序并使用结果(参见mediawiki 包中的includes/media/Bitmap.php)。
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.
你真的不能责怪人们放弃了 PHP 扩展,因为显然它必须使用“正确的”不断变化的编译器进行编译,并且至少与 apache 和 ImageMagick 构建相匹配。令人惊讶的是,这个问题已经持续了五年多,仍然没有得到处理。
So my "solution/answer" isn't really one, it basically is to call ImageMagick a different way to avoid the problem, like mediawiki did.
所以我的“解决方案/答案”并不是真正的一个,它基本上是调用 ImageMagick 一种不同的方式来避免这个问题,就像 mediawiki 那样。

