win10 php7.2 nginx 安装 imagick,适用于phpstudy

2021-07-07 13:07

阅读:493

标签:module   tar   link   rgba   mac   ons   kpi   enable   gradient   

imagick 拓展的下载地址

  1. https://windows.php.net/downloads/pecl/releases/imagick/ 可惜的是这个地址最新版没有php7.2, 如果是7.1可以推荐
  2. https://windows.php.net/downloads/pecl/snaps/imagick/ 这个snaps 版本支持php7.2, 此时最新为3.4.3

当前服务器为NGINX,  API320170718,NTS,VC15, 故PHP使用NTS版本,由此下载拓展:

https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/php_imagick-3.4.3-7.2-nts-vc15-x86.zip

拓展安装

  1. 解压压缩包得到如下一大坨文件

    $ ls php_imagick-3.4.3-7.2-ts-vc15-x64
    ChangeLog           CORE_RL_lqr_.pdb         CORE_RL_zlib_.pdb
    CORE_RL_bzlib_.dll  CORE_RL_MagickCore_.dll  CREDITS
    CORE_RL_bzlib_.pdb  CORE_RL_MagickCore_.pdb  LICENSE
    CORE_RL_glib_.dll   CORE_RL_MagickWand_.dll  LICENSE.IMAGEMAGICK
    CORE_RL_glib_.pdb   CORE_RL_MagickWand_.pdb  php_imagick.dll
    CORE_RL_lcms_.dll   CORE_RL_ttf_.dll         php_imagick.pdb
    CORE_RL_lcms_.pdb   CORE_RL_ttf_.pdb
    CORE_RL_lqr_.dll    CORE_RL_zlib_.dll

    需要做一个操作就是,删除非dll文件,因为没啥用

  2. 复制php_imagick.dll到拓展的ext目录, 并在php.ini中添加相应的配置,其他的dll并没有什么作用

  3. 测试执行一下,结果显示如下

    $ php --ri imagick
    
    imagick
    
    imagick module => enabled
    imagick module version => @PACKAGE_VERSION@
    imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
    Imagick compiled with ImageMagick version => ImageMagick 7.0.7-11 Q16 x64 2017-11-23 http://www.imagemagick.org
    Imagick using ImageMagick library version => ImageMagick 7.0.7-11 Q16 x64 2017-11-23 http://www.imagemagick.org
    ImageMagick copyright => Copyright (C) 1999-2015 ImageMagick Studio LLC
    ImageMagick release date => 2017-11-23
    ImageMagick number of supported formats:  => 0
    
    Directive => Local Value => Master Value
    imagick.locale_fix => 0 => 0
    imagick.skip_version_check => 0 => 0
    imagick.progress_monitor => 0 => 0
    //PHP 显示对应的报错
    NoDecodeDelegateForThisImageFormat `PNG‘ @ error\/constitute.c\/ReadImage\/509"

    而且这时候,无论你怎么复制原本的dll都没效果。所以这个时候要了解到,只有原本的几个dll是什么用处都没有的。

  4. 下载对应的imagick文件,比如这里是vc15 x86的版本,正好官网有提供依赖,(实际上这条是错误的到道路),官网的依赖不能解决问题

    https://windows.php.net/downloads/pecl/deps/ImageMagick-7.0.7-11-vc15-x86.zip

    下载解压,并添加路径到PATH中,php正常运行无错误,但实际查看细节就发现,还是和上面一样

  5. 检查发现ImageMagick的版本为7.0.7-11 Q16 x64, 实际上我只要去官网下载对应的版本即可。

    不一致的版本 https://www.imagemagick.org/download/binaries/ImageMagick-7.0.8-5-Q16-x86-dll.exe
    安装Imagick, 同时添加ImageMagick-7.0.8-Q16\modules\coders到系统Path中

    如果下载的版本不一致,执行时会出现一个警告,如下:但此时已经能正常运行,也可以看到7.0.8-5 Q16 x86 2显示了出来

    $php --ri imagick
    PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1799 but version 1800 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
    
    Warning: Version warning: Imagick was compiled against ImageMagick version 1799 but version 1800 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
    
    imagick
    
    imagick module => enabled
    imagick module version => @PACKAGE_VERSION@
    imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
    Imagick compiled with ImageMagick version => ImageMagick 7.0.7-11 Q16 x64 2017-11-23 http://www.imagemagick.org
    Imagick using ImageMagick library version => ImageMagick 7.0.8-5 Q16 x64 2018-07-05 http://www.imagemagick.org
    ImageMagick copyright => Copyright (C) 1999-2018 ImageMagick Studio LLC
    ImageMagick release date => 2018-07-05
    ImageMagick number of supported formats:  => 241
    ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, DXT1, DXT5, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FLIF, FPX, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YCbCr, YCbCrA, YUV
    
    Directive => Local Value => Master Value
    imagick.locale_fix => 0 => 0
    imagick.skip_version_check => 0 => 0
    imagick.progress_monitor => 0 => 0
  6. 正确的历史版本下载

    http://ftp.icm.edu.pl/packages/ImageMagick/binaries/ImageMagick-7.0.7-11-Q16-x86-dll.exe

    同样,这里可以找到许多历史版本下载,自己去处理即可,安装完毕后需要对应的将ImageMagick-7.0.7-Q16添加到PATH中,和7.0.8有所差异,看起来是文件结构有所调整。

完成安装以后

  1. 对应的拓展PECL官网有下载,各个不同的版本目录多找找。
  2. 官网的依赖文件夹的数据Imagick压缩包并不能直接作为依赖源使用。
  3. Imagick使用了不同的版本可能能运行,但会有警告。
  4. 下载需要使用-Q16-x64-dll.exe的安装版本,才有完整的数据。

imagickpcelphp

win10 php7.2 nginx 安装 imagick,适用于phpstudy

标签:module   tar   link   rgba   mac   ons   kpi   enable   gradient   

原文地址:https://www.cnblogs.com/caicaizi/p/9757988.html


评论


亲,登录后才可以留言!