欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

PHP imagick

程序员文章站 2024-02-06 13:35:28
...

PHP安装imagick-3.1.0RC2时提示: an error occur: fatal error: wand/MagickWand.h: No such file or directory 解决办法: 1.确认已安装 ImageMagick 2.安装pkgconfig 1 2 yum install gtk-devel ,可能是yum install gtk2-devel export PKG_CONFIG_PATH=/us

PHP安装imagick-3.1.0RC2时提示:

an error occur: fatal error: wand/MagickWand.h: No such file or directory

解决办法:
1.确认已安装 ImageMagick
2.安装pkgconfig

1

2

yum install gtk+-devel ,可能是yum install gtk2-devel

export PKG_CONFIG_PATH=/usr/local/ImageMagick/lib/pkgconfig/

确认ImageMagick 的安装目录是这个目录

3.重新安装PHP扩展:imagick

1

2

3

4

5

6

7

8

wget -c http://pecl.php.net/get/imagick-3.1.0RC2.tgz

tar zxvf imagick-3.1.0RC2.tgz

cd imagick-3.1.0RC2/

make clean

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/ImageMagick

make && make install

ldconfig -v /usr/local/


Ever go the following error while setting up ImageMagick?

“configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.”

Don’t panic. It’s a simple one and we can fix this right away. You are getting this error because you have only installed the “ImageMagick” package. You need to also install “ImageMagick-devel” and that will fix all the issues.

yum install ImageMagick-devel

That’s it!! Issue solved.


4. 配置使PHP加载imagick 扩展

1

vi /usr/local/php/etc/php.ini

#搜索 extension_dir, PHP 5.3.x中 extension_dir 的默认值一般设置成
#/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
添加一行记录

1

2

3

extension = "imagick.so"

#按键盘 ESC 键 退出编辑状态

:wq #保存退出

重启PHP, lnmpa 环境下,重启 Apache 即可

1

service httpd -k restart

附 ImageMagick,imagick 下载地址

ImageMagick http://www.imagemagick.org/script/download.php
imagick-3.1.0RC2 最新版下载 http://pecl.php.net/package/imagick

IMAGEMAGICK 安装教程:

1

2

3

4

5

6

7

wget -c ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.7.7-7.tar.gz

tar zxvf ImageMagick-6.7.7-7.tar.gz

cd ImageMagick-6.7.7-7/

./configure --prefix=/usr/local/ImageMagick/

make

make install

cd ../

测试是否安装成功

1

/usr/local/ImageMagick/bin/convert logo: logo.gif

如果没有提示任何错误,然后检查执行命令时所在的目录 看看是否生成了 logo.gif 这个文件

1

ll logo.gif

查看ImageMagick 版本及配置参数

1

/usr/local/ImageMagick/bin/identify -list configure

附录,linux下查看磁盘的剩余空间

1

df -lh

本文部分内容参考 http://www.g78.net/?p=288 在此感谢

参考文案:http://www.gemingcao.com/archives/linux-imagemagick-imagick.html