ZH奶酪:PHP安装扩展imagick

明明几个简单命令就能搞定,但是按照网上的方法就是不行,弄了一天,最后发现只需要两行命令,而且不需要修改什么php.ini:

sudo apt-get install php5-imagick
sudo service apache2 reload

 网上的其他方法:

(1)7个步骤:链接:http://stackoverflow.com/questions/3790191/php-error-class-imagick-not-found

sudo apt-get update    //Update libraries and packages
sudo apt-get autoremove    Remove obsolete things    
sudo apt-get install libmagickwand-dev    //For the libraries of ImageMagick
sudo apt-get install imagick    //For the core class Imagick
sudo pecl install imagick    //For create the binaries and conections in beetween
sudo echo "extension=imagick.so" >> /etc/php5/apache2/php.ini    //Append the extension to php.ini
sudo service apache2 restart    //Restart Apache

PS:PHP在/usr/lib/php5/20102525目录中搜索.so文件,但是imagick.so在文件/usr/lib/php5/20090626中。因此需要讲so文件赋值到php搜索的目录中。

(2)5个步骤:

链接:https://news.ycombinator.com/item?id=1726074

yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini
service httpd restart 

PS:上边的方法适用于使用yum包管理工具的i386系统(32位),在x86_64系统(64位)中需要把.i386修改为.x86_64

(3)4个步骤:Ubuntu

sudo apt-get install php5-dev pecl imagemagick libmagickwand-dev
sudo pecl install imagick
sudo apt-get install php5-imagick
sudo service apache2 restart

这是一个比较完整的PHP使用Imagick扩展的安装流程。

posted @ 2015-06-09 11:50  ZH奶酪  阅读(1378)  评论(0编辑  收藏  举报