需要下载的东西:
1
2
3
4
5
6
7
|
libwebp-0.5.1.
tar
.gz
wget
ImageMagick6.9.5.
tar
.gz
wget http:
//git
.imagemagick.org
/repos/ImageMagick/repository/archive
.
tar
.gz?ref=6.9.5-0
imagick-3.1.2.tgz
https:
//pecl
.php.net
/get/imagick-3
.1.2.tgz
|
一定要用ImageMagick6.9.5.tar.gz这个包,因为官方最新版的是ImageMagick-7.0.2-4,安装后有问题.
一.
1
|
yum -y
install
libpng-devel libjpeg-devel
|
二.安装webo库
1
2
3
4
5
6
|
[root@testserver-1 src]
# tar -zxvf libwebp-0.5.0.tar.gz
[root@testserver-1 src]
# cd libwebp-0.5.0/
[root@testserver-1 libwebp-0.5.0]
# ./configure && make && make install
[root@testserver-1 libwebp-0.5.0]
# cp /usr/local/lib/libwebp.so.6.0.0 /usr/lib64/
[root@testserver-1 libwebp-0.5.0]
# ln -s /usr/lib64/libwebp.so.6.0.0 /usr/lib64/libwebp.so.6
[root@testserver-1 libwebp-0.5.0]
# ln -s /usr/lib64/libwebp.so.6.0.0 /usr/lib64/libwebp.so
|
安装ImageMagick
1
2
3
4
5
|
[root@testserver-1 src]
# tar -zxvf ImageMagick6.9.5.tar.gz
[root@testserver-1 src]
# cd ImageMagick-6.9.5/
[root@testserver-1 ImageMagick-6.9.5]
# ./configure --prefix=/usr/local/imagemagick --with-webp
[root@testserver-1 ImageMagick-6.9.5]
# make && make install
[root@testserver-1 src]
# ln -s /usr/local/imagemagick/include/ImageMagick-6 /usr/local/imagemagick/include/ImageMagick
|
不同的地方:
1
2
3
4
|
[root@testserver-1 src]
# vim /etc/profile
export
MAGICK_HOME=
/usr/local/imagemagick/
export
PATH=$MAGICK_HOME
/bin
:$PATH
[root@testserver-1 src]
# source /etc/profile
|
没有上面那一步,可能会找不到convert命令。
安装php扩展
1
2
3
4
5
|
tar
-zxvf imagick-3.1.0RC2.tgz
cd
imagick-3.1.0RC2
/usr/local/php/bin/phpize
export
PKG_CONFIG_PATH=
/usr/local/imagemagick/lib/pkgconfig
.
/configure
--with-php-config=
/usr/local/php/bin/php-config
--with-imagick=
/usr/local/imagemagick
make
&&
make
install
|
有两个坑,就是用官方的最新版本ImageMagick,不正常.
本文转自 yawei555 51CTO博客,原文链接:http://blog.51cto.com/huwei555/1826692,如需转载请自行联系原作者