一种快速成功的办法
Centos服务器
yum install ImageMagick
yum install ImageMagick-devel
yum install php-pear
1.1 服务器php安装的lampp
/opt/lampp/bin/pecl install imagick
Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/imagick.so'
Installing '/opt/lampp/include/php/ext/imagick/php_imagick_shared.h'
install ok: channel://pecl.php.net/imagick-3.4.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
1.2 服务器php为nginx+php-fpm
# whereis php-fpm
php-fpm: /usr/sbin/php-fpm /etc/php-fpm.conf /etc/php-fpm.d /usr/share/man/man8/php-fpm.8.gz
# whereis pecl
pecl: /usr/bin/pecl
[root@iz2ze9n3z2fl9zj9hr58vz ~]# pecl install imagick
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading imagick-3.4.4.tgz ...
Starting to download imagick-3.4.4.tgz (253,434 bytes)
...................
Build process completed successfully
Installing '/usr/lib64/php/modules/imagick.so'
Installing '/usr/include/php/ext/imagick/php_imagick_shared.h'
install ok: channel://pecl.php.net/imagick-3.4.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
--1.2.1查看php.ini办法1
# whereis php.ini
php: /usr/bin/php /usr/lib/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/include/php /usr/share/php /opt/lampp.bak/bin/php /usr/share/man/man1/php.1.gz
--1.2.2查看php.ini办法2
编写个test.php 文件,直接去load一下。
vi a.php
发现imagick.so 权限不可执行,修改下
chmod 755 /usr/lib64/php/modules/imagick.so
在php.ini里加入extension=imagick.so无效
发现php.ini 加载插件的方式是加载/etc/php.d/下所有ini文件,所有用下面的命令行新建一个imagick.ini文件重启fpm就好了
echo "extension=imagick.so" > /etc/php.d/imagick.ini
service php-fpm restart
Windows系统
mac 系统
export MAGICK_HOME="$HOME/ImageMagick-7.0.7"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
export MAGICK_HOME="$/ImageMagick-7.0.7"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
安装
http://www.imagemagick.org/script/download.php#macosx
magick logo: logo.gif
identify logo.gif
display logo.gif
php插件手工安装
wget http://pecl.php.net/get/imagick-3.1.0RC1.tgz
tar -xzvf imagick-3.1.0RC1
tar.xz解压缩办法
$ xz -d node-v6.10.1-linux-x64.tar.xz
$ tar -xvf node-v6.10.1-linux-x64.tar
phpize
/Applications/XAMPP/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
make
make install
./configure --with-php-config=/Applications/XAMPP/bin/php-config --with-imagick=/usr/local/imagemagick
./configure --with-php-config=/Applications/XAMPP/bin/php-config --with-imagick=/Users/ge/ImageMagick-7.0.7
tar xvf 压缩文件名
/Applications/XAMPP/bin/phpize
./configure
各种报错
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
./configure --with-imagick=/Users/ge/ImageMagick-7.0.7/ --with-php-config=/Applications/XAMPP/bin/php-config
降低ImageMagick版本
wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.6.8-10.tar.gz
无法下载
这里可以
http://www.imagemagick.org/download/releases/
tar -xzvf ImageMagick-6.6.8-10.tar.gz
./configure --prefix=/usr/local/imagemagick
make
make install
##################################
2018-3-17 -2
下载http://www.imagemagick.org/download/releases/
http://www.imagemagick.org/download/releases/ImageMagick-6.5.4-10.tar.xz
xz -d ImageMagick-6.5.4-10.tar.xz
tar -xvf ImageMagick-6.5.4-10.tar
cd /Users/ge/imagek/ImageMagick-6.5.4-10
./configure --prefix=/usr/local/imagemagick
make
make install
低版本的ImageMagick 无法安装成功
我的Mac系统 macOS High Sierra v10.13
试试port安装
sudo port install ImageMagick
https://www.macports.org/install.php
phpize
/Applications/XAMPP/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
make
make install
MAC 系统失败2018-3-17
centos系统
cd /backup/soft
wget http://pecl.php.net/get/imagick-3.4.3.tgz
tar -xzvf imagick-3.4.3.tgz
pwd
/backup/soft/imagick-3.4.3
/opt/lampp/bin/phpize
./configure --with-php-config=/opt/lampp/bin/php-config --with-imagick=/usr/local/imagemagick
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
要先安装imagemagick 我没有继续,linux系统请回顶部看快速安装办法。