- 论坛徽章:
- 0
|
RedHat下安装Imagick,并整合进PHP
Imagick是一个好东西啊,比GD强大多了,可是从网上找到的安装方法都不怎么好用,搞了一天终于安装好了,贴出来和兄弟们共享一下。
首先说明一下环境,我的RH9是最小安装的,也就是说除了基本的文件以外没有其他的东西,关于Apache,MYSQL,以及PHP的安装请参考其他帖子。
下面是我的文件包,里面包含了我用到的所有文件,甚至包含了mysql、apache、php的源代码:http://www.ipbfans.cn/php_imagick.zip,请将其解压缩到合适的文件夹下
这里先假设你已经安装好了apache,mysql,并且PHP是自己通过源代码安装的。
1、安装libpng
- tar zxvf libpng-1.0.6.tar.gz
- cd libpng-1.0.6
- cd scripts
- cp ./makefile.linux ../makefile
- cd ..
- make && make install
复制代码
2、安装libjpeg
- tar zxvf jpegsrc.v6b.tar.gz
- cd jpeg-6b
- ./configure --enable-shared
- make && make install
复制代码
3、安装tiff
- tar -zxvf libtiff-lzw-compression-kit-1.1.tar.gz
- cd libtiff-lzw-compression-kit
- vi Makefile
复制代码
将
- TIFF_SRC_DIR=/tmp/libtiff
复制代码
改为
- TIFF_SRC_DIR=../tiff-v3.5.5
复制代码
退出vi,然后
然后
- tar zxvf tiff-v3.5.5.tar.gz
- cd tiff-v3.5.5
- ./configure && make && make install
复制代码
4、安装Image Magick
- tar -zxvf ImageMagick-5.5.7-31.tar.gz
- cd ImageMagick-5.5.7
- ./configure --enable-lzw=yes --enable-shared=yes --disable-static --without-perl
- make && make install
复制代码
ok,到现在为止,自定义的image magick就安装好了,下面将其整合到PHP里面:
这里假设你的PHP源代码路径为:/tmp/php_imagick/php-4.3.9
- cp ./imagick-0.9.8.tgz /tmp/php_imagick/php-4.3.9/ext
- cd /tmp/php_imagick/php-4.3.9/ext
- tar zxvf imagick-0.9.8.tgz
- mv imagick-0.9.8 imagick
- cd imagick-0.9.8
- phpize
复制代码
如果执行phpize的时候提示找不到文件之类的,请检查你的php是否正确安装,或者给出phpize的绝对路径
然后回到php源代码路径/tmp/php_imagick/php-4.3.9
- rm -rf ./configure
- ./buildconf --force
复制代码
如果这里提示buildconf失败,可以试试用我的压缩包里面的几个rpm升级一下系统的auto_conf
然后重新configure你的php,加上这个参数就可以了 --with-imagick
比如原来的是:
- ./configure --with-mysql=/usr/local/mysql --with-apxs2filter=/usr/local/apache/bin/apxs
复制代码
那么现在就变成:
- ./configure --with-mysql=/usr/local/mysql --with-apxs2filter=/usr/local/apache/bin/apxs --with-imagick
复制代码
如果你安装Image Magick的时候使用的是其他目录,那么在--with-imagick后面要改为--with-imagick=你的ImageMagick安装路径。
最后说明一点,在安装成功之前,我失败了N多次,郁闷啊~
如果要把ImageMagic整合到PHP里面,ImageMagic的版本不能低于5.3(好像是),我第一次下了一个低版本,到最后整合的时候才提示我……我也试过版本6以上的,不知道什么原因没有成功……
装好了以后可以取下一个PEAR的imagick类来用用看~
就这么多了
我的BLOG里面的原文:http://www.ipbfans.org/index.php?q=node/6 |
|