admin 管理员组文章数量: 887007
最近的PHP项目中,需要用到切图和缩图的效果,在linux测试服务器上很轻松的就安装好php imagick扩展。但是在本地windows开发环境,安装过程遇到好多问题,在此与大家分享。
1. 下载 ImageMagick
下载地址:http://imagemagick/script/binary-releases.php#windows
下载最新版本,ImageMagick-6.8.6-9-Q16-x86-dll.exe
2. 安装 ImageMagick
安装 ImageMagick 到 PC 上。安装路径不能出现空格,否则无法使用。安装时,一点选中把执行路径添加到 path 上,否则你就得手动去添加 path 路径了。
3. 测试安装
打开windows 命令行窗口(win+r -> “cmd” -> Enter),输入convert,回车。会出现convert的帮助文档,如果没有出现,说明没有安装成功,或没有把安装目录添加到环境变量 path 中。
添加到环境变量,如我的 ImageMagick 安装目录是 c:/imagemagick。
添加过程:
我的电脑 -> 右键点击 -> 高级系统设置 -> 高级 -> 环境变量 -> 系统变量 -> path -> 选择并编辑 -> 把你的安装目录,添加到其中
4. 下载 php扩展 php_imagick.dll
php5.4.x or php5.5.x 下载地址 http://www.peewit.fr/imagick/
dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit.
以上标识,同你下载的ImageMagick下载标识相同,本人用的是q16
5. 把dll文件重命名为php_imagick.dll,并放到php 扩展文件目录 php/ext 中。
6. 在 php.ini 配置文件中添加,extension=php_imagick.dll。
7. 重启电脑,只重启apache不管用的情况下,重启下PC。因为扩展底层使用的是imageMagic软件,所以软件重启电脑,重新加载软件,并刷新path路径。
8. 重启后,打开 phpinfo页面,查看,扩展已经安装成功。如果还未安装成功,极有可能imagemagick软件版本过高,请选择更低一级的版本安装。
9. PHP测试代码。
- 1
- 2
- 3
- 4
- 5
- 6
10. 查看手册,学习API
相关扩展学习手册地址 http://uk3.php/manual/zh/book.imagick.php 手册中包含大量易用实例。
这里还有查看命令行参数的文档 http://www.imagemagick/Usage/
DLL在这里下载:
点击打开链接
How to install ImageMagick to use with PHP on Windows 7 (3)
up vote 15 down vote favorite 12 |
There are other threads about how to install Imagick on Windows 7 but no help for me so far. :( (Maybe problems have came up with more recent versions) I have followed these steps to install:
When I start Apache i get a pop up box that displays:
Then directly after this comes another:
According to funtioneer I suspect some kind of compilation error. Now I have PHP Version 5.5.6 (xampp 1.8.3) with compiler MSVC11 wich is the same as for the php_imagick.dll file. Is download ImageMagick from source and compile it on my own the right way to go? (have never compiled in Windows before) php windows windows-7 imagemagick imagick
| |||
add a comment |
8 Answers
active oldest votesup vote 23 down vote |
Instead of using the latest version I tried downloading ImageMagick-6.7.7-5-Q16-windows-dll from http://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/binaries/. That one actually worked with the php_imagick.dll (Imagick for PHP 5.5.x) from http://www.peewit.fr/imagick/. This is not the latest version but it worked. (even without restarting the computer)
| ||||||||||||||||||||
|
up vote 9 down vote |
Here what finally worked for me after trying almost every possible solution posted in internet: Environment:
Download and install ImageMagick
Download corresponding .zip from Anatol suggested sources (kudos to Anatol!)
Extract to a temporary folder and copy the contents of the "bin" folder inside the Imagemagick installation Download Imagick for PHP 5.5.x Non Thread Safe from: http://www.peewit.fr/imagick/ Add the extension to php.ini with:
Save php.ini and restart IIS Finally Image Magick information was displayed in a phpinfo(); call. It is incredible to think to solve this problem needed to download files from 3 different locations. Hope it helps.
| ||||||||||||||||||||
|
up vote 7 down vote |
Here is what I did to get it working Note: The step that really tripped me up that didn't really explain is that the php_imagick.dll version should match your install of imagick Ok so steps I taken was download php imagick dll fromhttp://windows.php/downloads/pecl/releases/imagick/3.1.2/ (I used php_imagick-3.1.2-5.5-ts-vc11-x86.zip) The zip file will contain many dlls keep this in mind, we may need it in future. Extract php_imagick.dll to your extension folder Put that in extension folder IN php.ini add extension = php_imagick.dll Now the issue is we need to find out what version of imagick the php_imagick.dll was compiled for Open command prompt and type in php -e -v The way I did this was with the zip you downloaded earlier, extract the other DLLs to your php folder an error message will probably popup stating something about missing dlls. So extract the DLLs from the zip folder from before into your PHP folder. Try running php -e -v again and it should work fine with no error message. If that is the case then Restart apache. Now look at phpinfo() and go to the imagick section. It will say ImageMagick version: Mine said ImageMagick 6.8.6-8 which is an older version then they have on their site. The issue is that ImageMagick number of supported formats: will probably say zero. Go to http://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/binaries/ ANd download the matching version and install (when you install make sure the checkbox of adding to path variable is checked) Once finish installing Stop apache. Delete the DLLS from the php folder that you put in earlier and start apache again. Check restart apache and it should all work.
| ||||
|
up vote 3 down vote |
The ImageMagic distribution which should be used is from here http://windows.php/downloads/pecl/deps/ . The ImageMagic binaries need to be built with the same CRT as the PHP extension is.
| ||
add a comment |
up vote 0 down vote |
I get working ImageMagick with php 7 and IIS (Apache very similar):
1) Install VC++ 2015 https://www.microsoft/en-US/download/details.aspx?id=48145 2) Get ONLY 3) Put it into php/ext/ folder and add 4) install 5) restart server thats all
| ||||||||||||
|
up vote 0 down vote |
It works by following steps. Check what's bit of your system bit. Choose a Find If you don't know how to choose. Type Run following code shows which kind of php you have installed, On windows: On Linux: or you can run function You will see Other steps have already been written out by @embe.
| |||
add a comment |
up vote 0 down vote |
Now for something the documentation does not mention: setting the MAGICK_HOME value in your environment. ImageMagick requires this variable so it knows where to find all relevant coders. Open up the control pannel, and search for 'PATH'. In the results, select 'Edit the system environment variables'. Select the 'Environment variables...' option, and add a new 'System variable' (the lower list). If you've chosen a different installation path, make sure to replace C:\img with your own path. Variable: MAGICK_HOME Value: C:\img\modules\coders see more
| ||
add a comment |
up vote 0 down vote |
Please see installing-imagick-php-7 for installing imagick php extension on Windows using php 7.0 +. It's only real solution I have found so far. It goes into great detail.
| ||
add a comment |
protected by Community♦ Apr 17 at 19:22
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Not the answer you're looking for? Browse other questions tagged php windows windows-7 imagemagick imagick or ask your own question.
windows7下php5.4成功安装imageMagick,及解决php imagick常见错误问题。(phpinfo中显示不出来是因为:1.imagick软件本身、php本身、php扩展三方版本要一致,2.需要把CORE_RL_*.dll多个文件放到/php/目录下面)
windows7下 php5.4成功安装imageMagick 。
(phpinfo中显示不出来是因为:1.软件本身、php本身、php扩展三方版本要一致,2.需要把CORE_RL_*.dll多个文件放到/php/目录下面)
(作者:王奇疏 http://wwwblogs/wangqishu/p/5609950.html )
楼主需要用php处理一些特别的图片事宜,所以安装了iMagick for php来编写程序。
先看一下,这是我在windwos7安装成功的 imageMagick for php 的phpinfo()截图:
和调用imagick插件 的 php程序执行成功 截图:
安装步骤:
1). 先确定你使用的php版本情况,比如王奇疏的pc是win7的php : php5.4 x86 ts
那么就需要三方版本 要一致:imagick软件本身( 如x86 )、php本身( x86 ts (thread safe) )、php扩展php_imagick.dll (ts) 。
2).在已经安装了php的情况下,需要下载2个软件: imagick软件本身、php扩展php_imagick.dll扩展包:
imagick软件本身: http://imagemagick/script/binary-releases.php#windows
楼主选择的是:ImageMagick-6.8.9-6-Q16-x86-dll.exe 百度盘下载 运行安装即可。
(
因为最新版本的 php_imagick.dll (最新版本3.4.2 2016.06.22)
只支持到 ImageMagick 6.8.9 (2014-05-08)
所以,楼主已更换为 ImageMagick 6.8.9-1 Q16 x86.exe 楼主提供了1个百度盘下载地址,x64或其它版本请自行搜索摸索。
(by 王奇疏) 。
这是exe二进制安装包,如果你是x64位的请自行搜索这个版本的下载,或者你换了别的版本的请自行摸索测试。 如果你下载的是stable便携包相当于绿色版,那么需要自己把 文件路径 放到系统的环境变量。
)
php扩展php_imagick.dll扩展包:http://pecl.php/package/imagick/
楼主选择的是:http://pecl.php/package/imagick/3.4.2/windows
PHP 5.4 :5.4 Thread Safe (TS) x86
3).安装软件和配置
安装imagick软件本身,一直下一步即可;
安装php扩展插件:php_imagick.dll ,同其他php dll插件一样。
①.从php扩展压缩包中将php_imagick.dll 拖到/php/ext 目录下,
②.在php.ini开启插件 extension=php_imagick.dll ,
③. 从扩展压缩包中将多个 CORE_RL_*.dll 文件拖到 /php/ 目录下(否则重启apache或者 命令行 php -ri imagick 调试时报错找不到*.dll )
4. 重启Apache,查看 phpinfo() 中是否有 Imagick 项,如果有说明安装成功。
5. 需要另外 新建一个系统环境变量名为MAGICK_HOME,值为E:\你的imagick路径\modules\coders, 这步主要用来定位imagemagick的module,很重要。( 否则支持的图片格式数量默认为0, 无法处理图片。 ImageMagick number of supported formats: => 0 )
如果没有Imagick 项,请 使用 php扩展调试命令 来检查扩展中存在的问题, 并确保三方软件版本一致即可。
php扩展 调试命令:
在cmd运行: php --ri imagick
1. 如果报错是:“php_imagick.dll' - %1 不是有效的 Win32 应用程序” ,则说明版本不相符合。 需要检查 imagick软件本身( 如x86 )、php本身( x86 ts (thread safe) )、php扩展php_imagick.dll (ts) 三方版本 要一致。
2. 如果报错是:“php.exe - 系统错误 ,无法启动此程序因为计算机丢失CORE_RL_wand_.dll ” , 说明你没有将 php_imagick-3.3.0-5.4-ts-vc9-x86.zip 扩展包中的“CORE_*.dll” 这些dll文件 放到 你的php.exe同级目录下。 ,只需要拷贝 CORE_*.dll 到php目录就可以解决了。
3. 如果php --ri imagick 显示的结果 ImageMagick number of supported formats: => 0 支持的图片格式数量为0,请看第5步需要新建一个环境变量。
4.如果php代码执行调用时报错:“ NoDecodeDelegateForThisImageFormat ”,表明你的php_imagick.dll的版本 并不支持或并不匹配 ImageMagick软件版本,这时候 php --ri imagick 的结果也显示为: ImageMagick number of supported formats => 0 。需要更换ImageMagick软件版本。
最近在windows2003和iis6下面安装PHP的imagick扩展,耗费了很多时间,看见了很多资料,有些竟然是错的。现在把常用的文件列出来,有需要的朋友可以下载一下,当然也方便我下一次安装和调试,这里没有提供适合apache的文件,大家可以去对应网站找找:
1、PHP5.2.17我安装成功了,用的星外PHP5.2.17直接安装程序,下载imagick版本如下:
http://valokuva/outside-blog-content/imagick-windows-builds/080709/php_imagick_st-Q16.dll
(备份下载http://www.zzzyk/upload/20121109/php_imagick_st-Q16.dll)
已经包含imagemagick不需要安装任何东西,直接把php_imagick_st-Q16.dll复制到c:\php\ext目录
然后给php.ini扩展里面增加:extension=php_imagick_st-Q16.dll 最简单和绿色的方法
ps:还有诸如php_imagick_st-Q8.dll(8色),php_imagick_dyn-Q16.dll(需要安装imagemagick)就完全没必要管他们了
PHP5.2.17官方对应http://windows.php.NET/downloads/releases/php-5.2.17-nts-Win32-VC6-x86.zip
推荐下载星外版本http://www.zzzyk/upload/20121109/php5.2.17.rar安装很简单,基本上装了就可以使用php
2、PHP5.3.18 必须安装 imagemagick 已经没有可用的单文件dll了
1)下载 http://www.imagemagick/download/binaries/ImageMagick-6.8.0-4-Q16-windows-dll.exe
2)根据你的php安装模式下载 php_imagick
无线程安全:http://valokuva/builds/ext/vc9/nts/imagick/2011-04-25_1849/php_imagick_nts.dll
(备份下载:http://www.zzzyk/upload/20121109/php_imagick_nts__PHP5318.dll)
(通常iis6下面fastcgi对应http://windows.php.Net/downloads/releases/php-5.3.18-nts-Win32-VC9-x86.zip)
线程安全:http://valokuva/builds/ext/vc9/ts/imagick/2011-04-25_1849/php_imagick_ts.dll
(备份下载:http://www.zzzyk/upload/20121109/php_imagick_ts__PHP5318.dll)
(我已经没用isapi的php对应http://windows.php/downloads/releases/php-5.3.18-Win32-VC9-x86.zip)
复制到c:\php\ext目录,增加扩展例如:extension=php_imagick_nts.dll
3、PHP5.4.8 必须安装 imagemagick 已经没有可用的单文件dll了
1)下载 http://www.imagemagick/download/binaries/ImageMagick-6.8.0-4-Q16-windows-dll.exe
2)根据你的PHP安装模式下载 php_imagick
无线程安全:http://www.peewit.fr/imagick/vc9/x86/nts/php_imagick.dll
(备份下载:http://www.zzzyk/upload/20121109/php_imagick_nts.dll)
(对应http://windows.php/downloads/releases/php-5.4.8-nts-Win32-VC9-x86.zip)
线程安全:http://www.peewit.fr/imagick/vc9/x86/ts/php_imagick.dll
(备份下载:http://www.zzzyk/upload/20121109/php_imagick_ts.dll)
(对应http://windows.php/downloads/releases/php-5.4.8-Win32-VC9-x86.zip)
复制到c:\php\ext目录,增加扩展例如:extension=php_imagick.dll
以上安装本人都测试过,安装了重启iis,然后查看phpinfo看看有没有 imagick 如果没有的话,请检查权限或者重新做一次。也欢迎那些喜欢调试vc的朋友,把最新版本的imagemagick调成适合windows2003+iis平台使用的dll.
本文标签: 相关资料 你怕 巨坑 Imagick Windows
版权声明:本文标题:【巨坑--问你怕不怕】--windows下面配置imagick的相关资料。 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1733746590h1619749.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论