且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 php/windows 安装 ImageMagick 扩展

更新时间:2023-02-22 08:02:28

发现 非常 用户 Buttercup 给出的答案很有用,如果他能更清楚的话.

Found very useful tha answer given by user Buttercup, also if he could be more clear.

我的场景是 Windows 2012 R2 x64、PHP 5.5.19 x64,需要安装支持 PHP 的 ImageImagick.根据以下几点,我能够安装 ImageImagick 6.9.0 x64 和 PHP_Imagick.dll 3.1.2(目前都是最新的稳定版本).

My scenario was a Windows 2012 R2 x64, PHP 5.5.19 x64 and need to install ImageImagick with PHP support. Following points here below I was able to install ImageImagick 6.9.0 x64 and PHP_Imagick.dll 3.1.2 (both are currently the latest stable versions).

请注意,我在 NTS 和 x64 模式下下载了所有组件(PHP、ImageImagick 和 PHP_Imagick):不是在 TS 和/或 x86 模式下.我不知道这是否适用于您自己的情况.

Please note I downloaded all components (PHP, ImageImagick and PHP_Imagick) in NTS and x64 modes: not in TS and/or x86 modes. I don't know if this apply in your own case.

我在阅读 Buttercup(对于用户 RhoVisions)时不清楚的一点是他的评论:用 PHP 版本覆盖从 ImageMagick 6.8.8 Windows 版本中找到的 DLL".

The point it wasn't clear for me reading the Buttercup (as for user RhoVisions) was his comment: "Overwrite the DLLs found from ImageMagick 6.8.8 Windows version with the PHP version".

所以,这就是我所做的(基于 Buttercup 解决方案,我不得不一次又一次地感谢你!):

So, this is what I've done (based on Buttercup solution, who I have to say again and again thank you very much!):

  1. 链接下载最新的 ImageMagick EXE 安装程序在我的例子中,我下载了第一个可用的 HTTP 下载文件,标记为Win64 dynamic at 16 bits-per-pixel".(文件名:ImageMagick-6.9.0-0-Q16-x64-dll.exe)

  1. download latest ImageMagick EXE installer from Link In my case I downloaded the first file available as HTTP download labeled "Win64 dynamic at 16 bits-per-pixel" (filename: ImageMagick-6.9.0-0-Q16-x64-dll.exe)

运行刚刚下载的安装程序.我将它安装在一个简单的路径中,比如 C:ImageMagick6.9.0(但我认为将它从 Program Files 中移开并不重要).此外,我在安装过程中没有更改任何其他参数的默认值.

Run the installer just downloaded. I installed it in a simple path like C:ImageMagick6.9.0 (but I don't think it is so important to move it away from Program Files). Also, I didn't change any other parameter from their defaults during installing.

从 PECL 网站下载最新的 PHP_Imagick DLL 文件:http://pecl.php.网络/包/imagick我选择了一个稳定的(不是 Beta 或 RC)版本,在我的例子中是 3.1.2,点击Windows 标志"+DLL"标签.在我的情况下,它链接到 ht tp://pecl.php.net/package/imagick/3.1.2/windows .在它将打开的页面上,您会找到一个表格:您必须根据以下条件选择文件:a) 您拥有的 PHP 版本数(在我的情况下,有适用于 PHP 5.3、5.4、5.5、5.6 的可用 DLL)b) 您拥有的 PHP 的 x64 或 x86 版本c) 您拥有的 NTS 或 TS 版本的 PHP我的情况是 PHP 5.5.x、x64、NTS:所以我下载了一个标记为5.5 非线程安全 (NTS) x64"的文件.(文件名:php_imagick-3.1.2-5.5-nts-vc11-x64.zip)

download latest PHP_Imagick DLL file from PECL website at: http://pecl.php.net/package/imagick I choosed a stable (not Beta or RC) version, in my case 3.1.2, clicking on the "Windows logo"+"DLL" label. In my case it was linked to ht tp://pecl.php.net/package/imagick/3.1.2/windows . On the page it will open you'll find a table: you have to choose your file depending on: a) number of version of PHP you have (in my case there were available DLLs for PHP 5.3, 5.4, 5.5, 5.6) b) x64 or x86 version of PHP you have c) NTS or TS version of PHP you have My case is was PHP 5.5.x, x64, NTS: so I downloaded the one labeled "5.5 Non Thread Safe (NTS) x64" (file name: php_imagick-3.1.2-5.5-nts-vc11-x64.zip)

解压 php_imagick ZIP 并:a) 将 php_imagick.dll 文件复制到 PHP 安装的 EXT 文件夹中b) 从您刚刚解压到您在第 2 点选择的文件夹中的文件夹中复制并替换所有 CORE_RL_.dll.显然,请备份替换的文件.就我而言,我将 8 个 CORE_RL_.dll 文件从解压缩的文件夹复制到 C:ImageMagick6.9.0.我离开了 C:ImageMagick6.9.0 其他 CORE_RL_*.dll 没有被覆盖.

Unzip the php_imagick ZIP and: a) copy php_imagick.dll file into the EXT folder of your PHP installation b) copy and replace ALL the CORE_RL_.dll from the folder you just unzipped into the folder you choosed at point #2. Obviously, please backup replaced files. In my case I copied 8 CORE_RL_.dll files from unzipped folder to C:ImageMagick6.9.0. I leaved into C:ImageMagick6.9.0 the others CORE_RL_*.dll not overwritten.

编辑并保存您的 PHP.ini 文件以添加以下简单行:扩展=php_imagick.dll

Edit and save your PHP.ini file in order to add this simple row: extension=php_imagick.dll

重新启动您的服务器(不幸的是,我没有找到任何好的重新启动替代方法:来自管理命令提示符的 IISRESET 也不起作用).

Reboot your server (unfortunally I didn't find any good alternative of a reboot: also a IISRESET from admin command-prompt didn't work).

重启完成后,通过浏览器远程访问您的 phpinfo.php 文件以验证 Imagick 模块是否正常.就我而言,它是.

When reboot finished, visit remotely by browser your phpinfo.php file in order to verify that Imagick module was ok. In my case it was.

希望这会有所帮助,就在那里!

Hope this could help, out there!