更新时间:2023-02-22 20:10:54
我已在Windows 8.1 pro上为我的开发系统安装了 php 5.6 NTS x64
.
I have php 5.6 NTS x64
installed on Windows 8.1 pro for my Development System.
编辑:此过程也适用于Windows 10专业版.
This procedure worked with Windows 10 pro as well.
我无法使用Imagick使用较旧版本的ImageMagick与PHP一起工作,如接受的答案中所述,并且很难找到需要确切安全二进制文件的镜像(接受的答案中镜像上的二进制文件已下载为不同版本)比列出的要多).
I was unable to get Imagick Working with PHP using an older release of ImageMagick as in the accepted answer and it was difficult to find mirrors with the exact safe binaries needed (the binaries on the mirror in the accepted answer downloaded as different versions than listed).
在下面的所有步骤中,请确保将您的PHP体系结构(x86/x64和NTS/TS)与二进制体系结构相匹配.如果您使用的是PHP x86,请用x86(或32位)版本替换下载的x64版本.同样适用于PHP的线程安全(TS)和非线程安全(NTS)版本.
In all of the steps below, be sure to match your PHP architecture (x86/x64 and NTS/TS) to the binary's architecture. If you are using PHP x86 - replace the x64 version of the downloads with the x86 (or 32bit) version. The same applies to Thread-Safe (TS) and Non-Thread-Safe (NTS) versions of PHP.
通过执行以下操作,我终于使所有工作正常进行:
I finally got it all working by performing the following:
(3.3.0RC1)
.
php_imagick.dll
提取为 D:\php5.6\ext
CORE_RL_*.dll
文件提取到 D:\php5.6
-确保将 D:\php5.6
添加到PATH
系统环境变量 extension = php_imagick.dll
添加到 D:\php5.6\php.ini
(ImageMagick 6.9.1-2 Q16 x64)
以及缺少的受支持格式 (3.3.0RC1)
at time of this answer.
php_imagick.dll
to D:\php5.6\ext
CORE_RL_*.dll
files to D:\php5.6
- Ensure D:\php5.6
is also added to the PATH
of your system environment variables
extension = php_imagick.dll
to D:\php5.6\php.ini
(ImageMagick 6.9.1-2 Q16 x64)
and the missing supported formats
D:\php5.6\bin
from http://www.imagemagick.org/script/binary-releases.php - Ensure that the Add Path to Environment Variables
option is checked or manually add it .convert --version
displays the correct version CORE_RL_*.dll
files in D:\php5.6
(they will be loaded via ImageMagick path - otherwise your PHP installation may become unstable with the PECL dlls)
D:\php5.6\bin
to be able to convert PDFs to images from http://sourceforge.net/projects/ghostscript/ be sure to match the architecture for your installation
我不需要添加MAGICK_HOME
即可使Imagick使用PHP内置Web服务器或CGI进行工作,但是Apache可能需要使用mod_php
来运行.确保运行PHP的用户有权执行convert
.这应该通过D:\php5.6\bin
继承,但是如果您选择安装到C:\Program Files
.由于权限受限,您可能会遇到问题.
I did not need to add MAGICK_HOME
for Imagick to work using the PHP Built-In Web Server or CGI, but may be required for Apache using mod_php
. Be sure the user running PHP has permission to execute convert
. This should be inherited via D:\php5.6\bin
but in case you chose to install to C:\Program Files
. you may have issues due to its restricted permissions.
图像转换的替代方式
如评论中所述,您也可以下载必需的ImageMagick版本依赖项,并将exe
和dll
文件从bin
目录中直接提取到您的 D:\php5.6
目录中.
依赖性可以在PECL网站上找到 http://windows.php.net/downloads/pecl /deps/
As noted in the comments, you can alternatively download the required ImageMagick version dependencies and extract the exe
and dll
files from within the bin
directory directly into your D:\php5.6
directory.
The dependencies can be found on PECL website http://windows.php.net/downloads/pecl/deps/
使用PECL依赖项无需直接下载和 从供应商的网站运行匹配的ImageMagick版本安装程序.
Using the PECL dependencies removes the need to directly download and run the matching ImageMagick version installer from the vendor's website.
使用PECL依赖项方法时,使用GhostScript进行PDF转换所需的排除文件存在问题.
特殊注意事项
请确保重新排列PATH系统环境变量,以使%SystemRoot%\system32\convert.exe
不会覆盖D:\php5.6\bin\convert.exe
.
Be sure to rearrange your PATH System Environment Variable so that %SystemRoot%\system32\convert.exe
does not override the D:\php5.6\bin\convert.exe
.
通过将您的PHP路径添加到system32的左侧,如下所示: PATH:D:\php5.6\bin;%SystemRoot%\system32;%SystemRoot%;...
By adding your PHP path to the left of system32, like so: PATH: D:\php5.6\bin;%SystemRoot%\system32;%SystemRoot%;...
这将迫使您的系统在%SystemRoot%\system32
将D:\php5.6\bin\convert.exe
替换为您安装ImageMagick的路径或convert.exe
所在的路径
Replace D:\php5.6\bin\convert.exe
with the path to where you installed ImageMagick or the path to where convert.exe
is located
https://technet.microsoft.com/en-us /library/cc723564.aspx#XSLTsection127121120120