1、安装ImageMagic
[root@localhost download]# wget http://www.imagemagick.org/download/ImageMagick.tar.gz
[root@localhost download]# tar -xzvf ImageMagick
[root@localhost download]# cd ImageMagick-7.0.7-22/
[root@localhost ImageMagick-7.0.7-22]# ./configure --prefix=/usr/local/imagemagick --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
[root@localhost ImageMagick-7.0.7-22]# make
[root@localhost ImageMagick-7.0.7-22]# make install
2、检查是否安装成功
[root@localhost ImageMagick-7.0.7-22]# /usr/local/imagemagick/bin/convert -version
Version: ImageMagick 7.0.7-22 Q16 x86_64 2018-01-26 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): fontconfig freetype jng jpeg png x xml zlib
3、安装php扩展:imagick
[root@localhost download]# wget http://pecl.php.net/get/imagick-3.4.3.tgz
[root@localhost download]# tar -xzvf imagick-3.4.3.tgz
[root@localhost download]# cd imagick-3.4.3
[root@localhost imagick-3.4.3]# phpize
[root@localhost imagick-3.4.3]# ./configure --with-php-config=/usr/local/php-7.0.14/bin/php-config
[root@localhost imagick-3.4.3]# ./configure --with-php-config=/usr/local/php-7.0.14/bin/php-config --with-imagick=/usr/local/imagemagick
[root@localhost imagick-3.4.3]# make && make install
4、安装成功的提示
Build complete.
Don’t forget to run ‘make test’.
Installing shared extensions: /usr/local/php-7.0.14/lib/php/extensions/no-debug-non-zts-20151012/
Installing header files: /usr/local/php-7.0.14/include/php/
5、修改配置文件,将extension=imagick.so写进去
[root@localhost imagick-3.4.3]# vim /usr/local/php-7.0.14/etc/php.ini
6、重启php-fpm,测试是否安装成功
[root@localhost imagick-3.4.3]# killall php-fpm
[root@localhost imagick-3.4.3]# /usr/local/php-7.0.14/sbin/php-fpm
[root@localhost imagick-3.4.3]# php -m | grep imagick
imagick
7、安装成功