在百度查了好久,试验了好久,各种人写的各种不靠谱的帖子,通通失败,现在已经舍弃百度了,下面是我google出来的,经过验证后,很快实现了安装这俩扩展,介绍一下环境先,centos5 64bit,PHP5.6源码安装 ,yum源最好更新一下为阿里的,具体命令如下:
1.更新源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.下载源:
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3.运行源:
yum clean all
yum makecache
4.Yum安装PHP-pear:
yum -y install PHP-pear
5.Yum安装ImageMagick:
yum -y install ImageMagick*
pecl install Imagick
这一步需要手动指定Imagemagick的安装路径,因为Imagick需要找Imagemegick的库文件,where is Imagemegick就好了,我的是在/usr/local/Imagemagick下,回车,然后Imagick就自动编译安装了
6.检查一下是否安装成功:
PHP -i | grep Imagick
出现这些就说明成功了:
imagick classes => Imagick,ImagickDraw,ImagickPixel,ImagickPixelIterator,ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 6.9.5-7 Q16 x86_64 2016-08-18 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.5-7 Q16 x86_64 2016-08-18 http://www.imagemagick.org