沃梦达 / 编程问答 / php问题 / 正文

使用 php/windows 安装 ImageMagick 扩展

Installing ImageMagick extension with php/windows(使用 php/windows 安装 ImageMagick 扩展)

本文介绍了使用 php/windows 安装 ImageMagick 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有 IIS 的 Windows Server 2003 上运行 PHP 5.2.5 版.

Running PHP Version 5.2.5 on Windows Server 2003 with IIS.

拥有几乎完全相同的服务器,我们可以在其中毫无问题地安装 ImageMagick.它运行的是完全相同版本的 php.使用以下步骤进行安装,但它似乎无法在此服务器上运行.ImageMagick 本身已安装,但 php 不会加载扩展.

Have virtually an identical server where we were able to install ImageMagick with no issues. It's running exactly the same version of php. Used the following steps to install, but it just won't seem to work on this server. ImageMagick itself is installed but php won't load the extension.

我们花了几个小时试图安装扩展程序.它只是不会出现在 phpinfo() 中.

We've spent hours trying to get the extension installed. It just won't show up in phpinfo().

安装步骤

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

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

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

下载 php_imagick_dyn-Q16.dll 从http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/

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

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

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

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

extension=php_imagick.dll

  • 保存php.ini并重启Apache服务器.(如有必要,重新启动 Windows)

  • Save php.ini and restart Apache server. (If necessary, restart Windows)

    phpinfo() 应该显示 imagick 已启用.

    phpinfo() should show imagick enabled.

    推荐答案

    发现 非常 用户 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!

    这篇关于使用 php/windows 安装 ImageMagick 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

  • 本文标题为:使用 php/windows 安装 ImageMagick 扩展

    基础教程推荐