centos 6下php多版本共存,安装ImageMagick、imagick的方法
微wx笑 2022-04-19【运维日志】 3 0关键字: centos php imagick ImageMagick
前文 centos 6 php安装imagick支持webp格式图片处理 中记录了安装过程,但是当我又安装了一个php版本,多版本共存的情况下,给后来安装的php版本添加imagick支持的时候就出现问题
警告消息: [19-Apr-2022 17:01:59] NOTICE: PHP message: PHP Warning: PHP Startup: imagick: Unable to initialize module Module compiled with module API=20100525 PHP compiled with module API=20131226 These options need to match in Unknown on line 0 [19-Apr-2022 17:01:59] ERROR: An another FPM instance seems to already listen on /tmp/php-cgi-56.sock [19-Apr-2022 17:01:59] ERROR: FPM initialization failed
解决方法:
安装编译工具
yum install wget make gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl
安装imagemagick
cd ImageMagick-7.1.0-27/ ./configure --with-php-config=/www/server/php/56/bin/php-config --with-imagick=/usr/local/imagemagick make && make install export PKG_CONFIG_PATH=/usr/local/imagemagick/lib/pkgconfig/ #设置环境变量 ldconfig #这句或许不需要
参考:ldconfig命令
安装imagick
No releases available for package "pecl.php.net/imagick"
install failed
wget https://pecl.php.net/get/imagick-3.7.0.tgz --no-check-certificate tar -zxvf imagick-3.7.0.tgz cd imagick-3.7.0 /www/server/php/56/bin/phpize ./configure --with-php-config=/www/server/php/56/bin/php-config --with-imagick=/usr/local/imagemagick make && make install #可能需要加 sudo
Installing shared extensions: /usr/local/php/56/lib/php/extensions/no-debug-non-zts-20131226/ Installing header files: /usr/local/php/56/include/php/
kill -SIGINT `cat /usr/local/php/var/run/php-fpm.pid` #关闭php-fpm /usr/local/php/sbin/php-fpm #启动php-fpm
测试
<?php phpinfo(); ?>
imagick
imagick module | enabled |
---|---|
imagick module version | 3.7.0 |
imagick classes | Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel |
Imagick compiled with ImageMagick version | ImageMagick 7.1.0-27 Q16-HDRI x86_64 2022-03-04 https://imagemagick.org |
Imagick using ImageMagick library version | ImageMagick 7.1.0-27 Q16-HDRI x86_64 2022-03-04 https://imagemagick.org |
ImageMagick copyright | (C) 1999 ImageMagick Studio LLC |
ImageMagick release date | 2022-03-04 |
ImageMagick number of supported formats: | 233 |
ImageMagick supported formats | 3FR, 3G2, 3GP, A, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVIF, AVS, B, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, ERF, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNX, JPE, JPEG, JPG, JPS, JSON, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, O, ORA, ORF, OTB, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PWP, QOI, R, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TILE, TIM, TM2, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YAML, YCbCr, YCbCrA, YUV |
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/service/2022-04-19/1154.html