如何在 Windows 7 上安装 Imagick/imagemagick PHP 扩展

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3036847/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:29:38  来源:igfitidea点击:

How to install Imagick/imagemagick PHP extension on windows 7

phpimageimagemagickgdimagick

提问by DEVOPS

How to install image magic in Windows 7. I followed these instruction

如何在 Windows 7 中安装 image magic。我遵循了这些说明

To install IMagick on Windows XP (php 5.2.x)

在 Windows XP (php 5.2.x) 上安装 IMagick

  1. download and install ImageMagick-6.5.8-7 Q16-windows-dll.exe http://www.imagemagick.org/download/binaries/ImageMagick-6.5.8-7-Q16-windows-dll.exe

  2. download php_imagick_dyn-Q16.dll from: http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/

    copy dll to [PHP]/extension dir and rename it to php_imagick.dll

  3. You have to edit your php.ini file and add new extension

    extension=php_imagick.dll
    
  4. Save ini file and restart apache server.

    (If necessary, restart your windows)

  5. phpinfo()should show imagick enabled.

  1. 下载并安装 ImageMagick-6.5.8-7 Q16-windows-dll.exe http://www.imagemagick.org/download/binaries/ImageMagick-6.5.8-7-Q16-windows-dll.exe

  2. 下载php_imagick_dyn-Q16.dll来自: http://valokuva.org/outside-blog-content/imagick窗口,建立/ 080709 /

    将 dll 复制到 [PHP]/extension 目录并将其重命名为 php_imagick.dll

  3. 您必须编辑 php.ini 文件并添加新的扩展名

    extension=php_imagick.dll
    
  4. 保存ini文件并重启apache服务器。

    (如有必要,请重新启动 Windows)

  5. phpinfo()应该显示启用 imagick。

after that I execute a sample script but its not working. It shows the Imagicclass missing error.

之后我执行了一个示例脚本,但它不起作用。它显示Imagic类丢失错误。

Fatal error: Class 'Imagick' not found in C:...\imgborder.php on line XXX

致命错误:在第 XXX 行的 C:...\imgborder.php 中找不到“Imagick”类

Please help me to install Imagick. :-(

请帮我安装Imagick。:-(

采纳答案by chanchal1987

Check permissions on the .dll file to make sure the Apache user has read access to the file. Better change the permission of the [PHP]/extension directory.

检查 .dll 文件的权限以确保 Apache 用户对该文件具有读取权限。最好更改[PHP]/extension 目录的权限。

To change the permission

更改权限

  1. Right click the file(s) or folder(s)
  2. Select "Properties"
  3. Select "Security" tab
  4. Click on "Edit" button.
  1. 右键单击文件或文件夹
  2. 选择“属性”
  3. 选择“安全”选项卡
  4. 单击“编辑”按钮。

Change the permission of user to Full Control.

将用户的权限更改为完全控制。

回答by Gras Double

  • Download the binaries on the PECL page(look for the "DLL" links).
  • Open the archive, copy all the *.dll files to the "php\ext" directory.
  • Add the extension to your php.ini:

    • Usually you should add extension=php_imagick.dll.
    • On some WAMP platforms, it might be instead extension=ext/php_imagick.dll. Just look how the existing extensions are defined and do alike.
  • Restart web server.
  • PECL 页面下载二进制文件(查找“DLL”链接)。
  • 打开存档,将所有*.dll 文件复制到“php\ext”目录。
  • 将扩展添加到您的 php.ini:

    • 通常你应该添加extension=php_imagick.dll.
    • 在某些 WAMP 平台上,它可能是extension=ext/php_imagick.dll. 看看现有的扩展是如何定义的,并做类似的事情。
  • 重新启动网络服务器。


At this point, Imagick is installed, but you will probably encounter this error:


此时,Imagick 已安装,但您可能会遇到此错误:

ImagickException: NoDecodeDelegateForThisImageFormat

ImagickException: NoDecodeDelegateForThisImageFormat

It means you have to install ImageMagick as well:

这意味着您还必须安装 ImageMagick:

  • On this page, download the ImageMagick archive corresponding to the Imagick you have installed (MSVC version, CPU architecture).
  • Open "bin" directory of this archive, copy the *.dll files to the "php\ext" directory. For example, you'll need IM_MOD_RL_jpeg_.dll for JPEG handling.
  • 此页面下载与您安装的 Imagick 对应的 ImageMagick 存档(MSVC 版本,CPU 架构)。
  • 打开这个存档的“bin”目录,将*.dll文件复制到“php\ext”目录。例如,您需要 IM_MOD_RL_jpeg_.dll 来处理 JPEG。

回答by i0707

Here are Windows binaries for imagick2.3.0 compiled with VC6 (you can find VC9 binaries at Mikko's blog) against PHP 5.3.2 (API20090626).

以下是针对 PHP 5.3.2 (API20090626) 使用 VC6 编译的imagick2.3.0 的Windows 二进制文件(您可以在 Mikko 的博客中找到 VC9 二进制文件)。

Try this link

试试这个链接

回答by funktioneer

I've research this solution, here you will find all necessary libraries. Download this http://image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.6.2-10-Q16-windows-dll.exe

我已经研究了这个解决方案,在这里你会找到所有必要的库。下载这个 http://image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.6.2-10-Q16-windows-dll.exe

Find your DLLs here http://www.peewit.fr/imagick/

在此处找到您的 DLL http://www.peewit.fr/imagick/

To know which library fit your needs easily run phpinfo()

要知道哪个库适合您的需求,请轻松运行 phpinfo()

There you find the following row e.g.

在那里您会找到以下行,例如

Compiler MSVC9 (Visual C++ 2008)

编译器 MSVC9 (Visual C++ 2008)

The MSVC9 tells you that it's compiled with Visual C9, so you need to download the VC9 version. Thats all.

MSVC9 告诉你它是用 Visual C9 编译的,所以你需要下载 VC9 版本。就这样。

Have nice day, takes me several hours of research.

祝你有美好的一天,我花了几个小时的研究。

回答by einpoklum

This may be hitting a nail with a 5-pound hammer, but I like Cygwin, a Unix-like environment for Windows; it includes imagemagick as a package.

这可能是用 5 磅重的锤子敲钉子,但我喜欢Cygwin,它是 Windows 的类 Unix 环境;它包含 imagemagick 作为一个包。

回答by Jonathan

Just use chocolatey

只用巧克力

choco install imagemagick

choco install imagemagick

Done

完毕