php 在 WAMP 上安装 IMAGEMAGICK 的分步说明?

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

step-by-step instructions for installing IMAGEMAGICK on WAMP?

phpimagemagickwamp

提问by Haroldo

There don't seem to be any concise tutorials/walk throughs for installing ImageMagick on WAMP for use with PHP.

在 WAMP 上安装 ImageMagick 以与 PHP 一起使用似乎没有任何简明的教程/演练。

I've tried dozens of combinations of their binary releases with different php extension dll files. I can get imagemagick working fine from the command line, and I can get it to show as ticked in the WAMP extensions, but can't actually use it.

我已经尝试了数十种二进制版本与不同 php 扩展 dll 文件的组合。我可以从命令行让 imagemagick 正常工作,我可以让它在 WAMP 扩展中显示为勾选状态,但实际上无法使用它。

Has anyone come across a good guide for installing this ball ache piece of software?

有没有人遇到过安装这个球痛软件的好指南?

I've followed http://www.knowledge-transfers.com/it/installing-imagemagick-on-windows-setup-imagick-on-phpwith no luck...

我已经关注了http://www.knowledge-transfers.com/it/installing-imagemagick-on-windows-setup-imagick-on-php没有运气...



Update: this is what happens when I follow the steps in PHP farmer's answer on windows7. My php.ini is setup as follows:

更新:当我在 windows7 上按照 PHP 农民的回答中的步骤进行操作时会发生这种情况。我的 php.ini 设置如下:

extension_dir = "c:/wamp/bin/php/php5.3.0/ext/"

extension=php_imagick.dll

I reboot and get these two errors in this order

我重新启动并按此顺序出现这两个错误

alt textalt text

替代文字替代文字

and here is the dll file where it should be:

这是它应该在的dll文件:

alt text

替代文字

回答by fsasvari

I know this is old post but I spend my all day to make it work, so here are the steps that helped me:

我知道这是旧帖子,但我花了一整天的时间让它工作,所以这里是帮助我的步骤:

  1. Download ImageMagick Binary Release - http://www.imagemagick.org/script/download.php
  2. Install in C:\imagemagick, on last step check "Add application directory to your system path"
  3. Download Imagick DLL: PHP5.6.xversion from http://www.peewit.fr/imagick/(I have 5.6+ version installed on my localhost
  4. Copy php_imagick.dllto C:\wamp\bin\php\ext
  5. Download PHP 5.6 Thread Safe (TS) x86version from http://pecl.php.net/package/imagick/3.1.2/windows
  6. Copy CORE_RL_*files to C:\wamp\bin\apache\bin\
  7. Edit php.inifile in C:\wamp\bin\apache\bin\php.ini, add extension=php_imagick.dllline in extensions section
  8. Copy all files from C:\imagemagick\modules\codersand C:\imagemagick\modules\filtersto C:\imagemagickto load ImageMagick supported formats
  9. Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick
  10. Restart Wamp server and check phpinfo() for imagick plugin
  11. If last step does not work, restart Windows
  1. 下载 ImageMagick 二进制版本 - http://www.imagemagick.org/script/download.php
  2. 安装在C:\imagemagick,在最后一步检查“将应用程序目录添加到您的系统路径
  3. http://www.peewit.fr/imagick/下载Imagick DLL:PHP5.6.x版本(我的本地主机上安装了 5.6+ 版本
  4. php_imagick.dll复制到C:\wamp\bin\php\ext
  5. http://pecl.php.net/package/imagick/3.1.2/windows下载PHP 5.6 线程安全 (TS) x86版本
  6. CORE_RL_*文件复制到 C:\wamp\bin\apache\bin\
  7. 编辑的php.ini在文件C:\瓦帕\ BIN \阿帕奇\ BIN \ php.ini中,附加扩展= php_imagick.dll在扩展部分线
  8. 将所有文件从C:\imagemagick\modules\codersC:\imagemagick\modules\filters复制到C:\imagemagick以加载 ImageMagick 支持的格式
  9. 转到控制面板 -> 系统 -> 高级设置 -> 环境变量 -> 新系统变量 -> MAGICK_HOME = C:\imagemagick
  10. 重新启动 Wamp 服务器并检查 phpinfo() 以获取 imagick 插件
  11. 如果最后一步不起作用,请重新启动 Windows

回答by MudithaE

I have improved fsasvarianswer to cater general scenarios and versions. All credits to him.

我改进了fsasvari答案以迎合一般情况和版本。所有功劳都归功于他。

Install Imagick in WAMP

在 WAMP 中安装 Imagick

  1. Open your phpinfo() page
  2. Check the below
    PHP version (mine : 5.5.12)
    Compiler (mine : MSVC11 (Visual C++ 2012) )
    Architecture : (mine : x64)
    Thread Safety : enabled
    Loaded Configuration File (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
    extension_dir : (mine : c:/wamp/bin/php/php5.5.12/ext/)
    Apache Bin (Not in phpinfo() page) : C:\wamp\bin\apache\apache2.4.9\bin\

  3. Get the latest release match to your architecture from here(for me it was ImageMagick-x86_64-pc-windows.exe).

  4. Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats

  5. Install in C:\imagemagick, on last step check "Add application directory to your system path"

  6. Download the PECL matching to your architecture http://pecl.php.net/package/imagick/3.1.2/windows(for me : 5.5 Thread Safe (TS) x64)

  7. Extract it and copy all the CORE_RL_* files to apache bin folder (mine : C:\wamp\bin\apache\apache2.4.9\bin)

  8. Copy php_imagick.* files to extension dir (mine : c:/wamp/bin/php/php5.5.12/ext/)

  9. Edit php.ini file (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
    add extension=php_imagick.dllline in extensions section

  10. Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick

  11. Restart Wamp server and check phpinfo() for imagick plugin

  12. If last step does not work, restart Windows (Specially if you have previously installed imagemagick in different folder/version)

  1. 打开你的 phpinfo() 页面
  2. 检查以下
    PHP 版本(我的:5.5.12)
    编译器(我的:MSVC11(Visual C++ 2012))
    架构:(我的:x64)
    线程安全:启用
    加载的配置文件(我的:C:\wamp\bin\apache\apache2 .4.9\bin\php.ini)
    extension_dir : (我的:c:/wamp/bin/php/php5.5.12/ext/)
    Apache Bin(不在 phpinfo() 页面中):C:\wamp\bin\apache\ apache2.4.9\bin\

  3. 这里获取与您的架构匹配的最新版本(对我来说是ImageMagick-x86_64-pc-windows.exe)。

  4. 将所有文件从 C:\imagemagick\modules\coders 和 C:\imagemagick\modules\filters 复制到 C:\imagemagick 以加载 ImageMagick 支持的格式

  5. 安装在 C:\imagemagick,最后一步勾选“将应用程序目录添加到您的系统路径”

  6. 下载与您的架构相匹配的 PECL http://pecl.php.net/package/imagick/3.1.2/windows(对我来说:5.5 线程安全 (TS) x64)

  7. 解压并将所有 CORE_RL_* 文件复制到 apache bin 文件夹(我的:C:\wamp\bin\apache\apache2.4.9\bin)

  8. 将 php_imagick.* 文件复制到扩展目录(我的:c:/wamp/bin/php/php5.5.12/ext/)

  9. 编辑 php.ini 文件(我的:C:\wamp\bin\apache\apache2.4.9\bin\php.ini) 在扩展部分
    添加extension=php_imagick.dll

  10. 转到控制面板 -> 系统 -> 高级设置 -> 环境变量 -> 新系统变量 -> MAGICK_HOME = C:\imagemagick

  11. 重新启动 Wamp 服务器并检查 phpinfo() 以获取 imagick 插件

  12. 如果最后一步不起作用,请重新启动 Windows(特别是如果您之前在不同的文件夹/版本中安装了 imagemagick)

回答by Medda86

For WAMPSERVER 3.1.9 64bit, PHP Version: 7.3.5

对于 WAMPSERVER 3.1.9 64 位,PHP 版本:7.3.5

I had a lot of trouble with this as well and some things I did wrong was that I doubted ImageMagick would load on my new php version. But you have to believe it will work and don't try with older php versions :)

我也遇到了很多麻烦,我做错的一些事情是我怀疑 ImageMagick 会加载到我的新 php 版本上。但是你必须相信它会起作用,不要尝试使用旧的 php 版本:)

So this was my approach, remember to follow it with your own settings and versions/folders.

所以这是我的方法,请记住使用您自己的设置和版本/文件夹来遵循它。

Before you start, make sure you running the php version you want to run. If you installed Wampserver 3, you may click the wamp icon and go to php version and activate the one you want to run.

在开始之前,请确保您运行的是您想要运行的 php 版本。如果您安装了 Wampserver 3,您可以单击 wamp 图标并转到 php 版本并激活您要运行的版本。



1

1

Get latest ImageMagickversion for your system here: http://ftp.icm.edu.pl/packages/ImageMagick/binaries/

在此处获取适用于您系统的最新ImageMagick版本:http: //ftp.icm.edu.pl/packages/ImageMagick/binaries/

(I got the ImageMagick-x86_64-pc-windows.exein the bottom)

(我在底部得到了ImageMagick-x86_64-pc-windows.exe



2

2

Install ImageMagickin C:/imagemagick(I put it in lower cases), You will be asked for some stuff during install, just make sure the paththingy is ticked.

C:/imagemagick 中安装ImageMagick(我把它放在小写),在安装过程中你会被要求提供一些东西,只要确保路径thingy 被勾选。

You should also tick the convertthingy if it allows you.

如果允许,您还应该勾选转换内容。

Then after install you can run CMDand type convert -versionto see if imagick is installed.

然后安装后,您可以运行 CMD并键入convert -version以查看是否安装了 imagick。



3

3

Run <?php phpinfo(); ?>And find out these settings:

运行<?php phpinfo(); ?>并找出这些设置:

PHP Version:7.3.5

PHP 版本:7.3.5

System:Windows

系统:视窗

Compiler:MSVC15 (Visual C++ 2017) ([VC15])

编译器:MSVC15 (Visual C++ 2017) ([VC15])

Architecture:x64 (or maybe you have x86)

架构:x64 (或者你有 x86)

Thread Safety:enabled ([TS] else [NTS])

线程安全:启用([TS] 否则 [NTS])

You probably have other settings, but you need to remember yours to download the proper php_imagick.dll

您可能有其他设置,但您需要记住您的设置以下载正确的php_imagick.dll



4

4

Get the php_imagick.dllyou want for your php version from here: http://pecl.php.net/package/imagick

从这里获取您的 php 版本所需的php_imagick.dllhttp: //pecl.php.net/package/imagick

I got mine from here: http://pecl.php.net/package/imagick/3.4.4/windowsfor php 7.3

我从这里得到了我的:http: //pecl.php.net/package/imagick/3.4.4/windowsfor php 7.3

Remember your info from the phpinfo(), it has to match, else it won't work.

记住来自 phpinfo() 的信息,它必须匹配,否则将无法工作。



5

5

After you unzip it, copy the php_imagick.dlland paste it in C:/wamp64/bin/php/php7.3.5/ext/

解压后,复制php_imagick.dll并粘贴到C:/wamp64/bin/php/php7.3.5/ext/

Then copy all the other .dllfiles from that folder into C:/wamp64/bin/apache/apache2.4.39/bin/

然后将该文件夹中的所有其他.dll文件复制到C:/wamp64/bin/apache/apache2.4.39/bin/

Yes it's dirty but you will get it working like this.

是的,它很脏,但你会让它像这样工作。



6

6

Add extension=php_imagick.dllin C:/wamp64/bin/php/php7.3.5/phpForApache.ini

C:/wamp64/bin/php/php7.3.5/phpForApache.ini添加extension= php_imagick.dll

I added it after the other extensions in the file.

我在文件中的其他扩展名之后添加了它。



7

7

Restart all Wamp services.

重新启动所有 Wamp 服务。

If you been messing around earlier with installs, you might have to restart the computer due to some weird cache stuff.

如果您之前一直在安装,由于一些奇怪的缓存内容,您可能必须重新启动计算机。



8

8

Check phpinfo() again if imagick shows up and try something like $im = new Imagick();

如果 imagick 出现,请再次检查 phpinfo() 并尝试类似的操作 $im = new Imagick();



9

9

Click the Wamp icon -> php -> extensions, php_imagickshould be listed.

单击 Wamp 图标 -> php -> 扩展,应列出php_imagick



Good luck! :)

祝你好运!:)

回答by Trevor

This was a headache for me as well, but unfortunately I installed this quite awhile ago. The instructions from that link you posted seem accurate. Have you ran phpinfo(); to see if it is installed in the Apache Environment? It should be listed as MAGICK_HOME.

这对我来说也很头疼,但不幸的是我很久以前就安装了它。您发布的该链接中的说明似乎准确。你运行过 phpinfo(); 看看它是否安装在Apache环境中?它应该被列为 MAGICK_HOME。

Make sure "SetEnv MAGICK_HOME C:/imagemagick" is set at the end of your httpd.conf file. Assuming imagemagick is installed in that directory.

确保在 httpd.conf 文件的末尾设置了“SetEnv MAGICK_HOME C:/imagemagick”。假设 imagemagick 安装在该目录中。

Be sure that you have the extension "php_imagick.dll" in your php.ini file as well.

确保您的 php.ini 文件中也有扩展名“php_imagick.dll”。

It should work just fine if you have all those set.

如果您设置了所有这些,它应该可以正常工作。

On another note, here is a nice little library someone built to make imagick easier to use. https://github.com/francodacosta/phmagick

另一方面,这里有一个不错的小库,旨在使 imagick 更易于使用。https://github.com/francodacosta/phmagick

I hope that helps! Good luck!

我希望这有帮助!祝你好运!

回答by psycho brm

PHP 5.4 php_imagick.dll is here: http://www.peewit.fr/imagick/. I read somewhere that 64bit php doesnt work with php_imagick. That might be the case when you get this error in apache_error.log

PHP 5.4 php_imagick.dll 在这里:http://www.peewit.fr/imagick/ 。我在某处读到 64 位 php 不适用于 php_imagick。当您在 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

As mentioned above, it was also necessary to add this into httpd.conf (also, i read you cant have spaces/dashes/dots):

如上所述,还需要将其添加到 httpd.conf (另外,我读到您不能有空格/破折号/点):

SetEnv MAGICK_HOME C:/imagemagick"

If you dont, you might get this error:

如果不这样做,您可能会收到此错误:

"PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' -
The specified procedure could not be found. in Unknown on line 0"

In the end, this article might partially help: http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/

最后,这篇文章可能会有所帮助:http: //www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/

回答by Ahsan

I know this is an old question but i guess this will help someone someday out there....

我知道这是一个老问题,但我想这会帮助某个人有一天....

If you are on WAMPP and have PHP 5.4.x installed , go here http://www.peewit.fr/imagick/

如果您使用 WAMPP 并安装了 PHP 5.4.x,请访问http://www.peewit.fr/imagick/

and download appropriate files as instructed. It will work.

并按照说明下载适当的文件。它会起作用。

回答by Stacey Richards

I've never used WAMP but I have found that sometimes installing PHP extensions on Windows I need to ensure that any dll's that the extension relies on is in the Windows system PATH. If there is more than the one dll packaged with the imagemagick extension, try adding the directory that the dll's reside in to the Windows system PATH then REBOOT (to ensure that the web server gets a copy of the NEW environment).

我从未使用过 WAMP,但我发现有时在 Windows 上安装 PHP 扩展时,我需要确保扩展所依赖的任何 dll 都在 Windows 系统路径中。如果使用 imagemagick 扩展打包的 dll 不止一个,请尝试将 dll 所在的目录添加到 Windows 系统路径中,然后重新启动(以确保 Web 服务器获得新环境的副本)。

回答by buttercup

Please see this answer already on StackOverflow:

请在 StackOverflow 上看到这个答案:

Installing ImageMagick extension with php/windows

使用 php/windows 安装 ImageMagick 扩展

I answered this question some time ago. This solves the DLL mismatch error.

我前段时间回答过这个问题。这解决了 DLL 不匹配错误。