Linux下安装PHP的GD支持库
GD:Linux下安装PHP的GD支持库
Linux下安装PHP的GD支持库
1、安装zlib
wgetftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz
tar-zxfzlib-1.2.3.tar.gz
cdzlib-1.2.3
./configure–prefix=/usr/local/zlib
make
makeinstall
2、安装jpeg
wgetftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg-6b.tar.gz
mkdir-p/usr/local/jpeg6
mkdir-p/usr/local/jpeg6/bin
mkdir-p/usr/local/jpeg6/lib
mkdir-p/usr/local/jpeg6/include
mkdir-p/usr/local/jpeg6/man
mkdir-p/usr/local/jpeg6/man1
mkdir-p/usr/local/jpeg6/man/man1
tar-zxfjpeg-6b.tar.gz
cdjpeg-6b
./configure–prefix=/usr/local/jpeg6–enable-shared–enable-static
make
makeinstall
安装完成提示:
Librarieshavebeeninstalledin:
/usr/local/jpeg6/lib
3、安装libpng
wgetftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz
tar-zxflibpng-1.2.16.tar.gz
cdlibpng-1.2.16
cdscripts/
mvmakefile.linux../makefile(必须)
cd..
./configure-prefix=/usr/local/libpng
make
makeinstall
4、安装freetype
wgethttp://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gz
tar-zxffreetype-2.3.4.tar.gz
cdfreetype-2.3.4
mkdir-p/usr/local/freetype
./configure–prefix=/usr/local/freetype
make
makeinstall
5、安装GD
wgetftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gz
tar-zxfgd-2.0.33.tar.gz
cdgd-2.0.33
mkdir-p/usr/local/gd2
./configure–prefix=/usr/local/gd2–with-jpeg=/usr/local/jpeg6/–with-png=/usr/local/lib/–with-zlib=/usr/local/lib/–with-freetype=/usr/local/freetype/
make
makeinstall
--------------------
安装jpg时候,如果出错。
先装libtool
libtool-1.X.tar.gz//是我下载的版本
./configure
make
makeinstall
再装jpegsrc.v6b.tar.gz
./configure--enable-shared--enable-static这些lib这种包用默认路径就行。不然如果其他的需要这个包还得指它的路径
这里可能会出错
checkinghostsystemtype…Invalidconfiguration`x86_64-unknown-linux-gnu‘:machine`x86_64-unknown‘notrecognized
checkingbuildsystemtype…Invalidconfiguration`x86_64-unknown-linux-gnu‘:machine`x86_64-unknown‘notrecognized
configure:error:libtoolconfigurefailed
或者
/libtool--mode=compilegcc-O2-I.-c./jcapimin.c
make:./libtool:命令未找到
make:***[jcapimin.lo]错误127
./libtool--mode=compilegcc-O2-I.-c./cjpeg.c
make:./libtool:命令未找到
make:***[cjpeg.lo]错误127
解决方法
cp/usr/share/libtool/config.guess.
cp/usr/share/libtool/config.sub.
cp到jpeg的安装文件目录,注意后面的个“.”
makeclean
再重新
./configure--prefix=/usr/local/libjpeg/--enable-shared--enable-static
make
makeinstall
--------------------------------
如果已经安装php,建议通过追加编译安装
进入“[php解压目录]/ext/gd”目录,执行如下命令:
[php安装目录]/bin/phpize
Java代码
./configure--with-php-config=[php安装目录]/bin/php-config--with-jpeg=[jpeg-6b安装目录]--with-png=[libpng安装目录]--with-freetype=[freetype安装目录]--with-gettext=[gettext安装目录]--with-gd=[gd安装目录]
make
makeinstall
安装成功后会在“[php安装目录]/lib/php/extensions/no-debug-non-zts-20060613”目录下生成gd.so文件,
然后cp[php安装目录]/lib/php/extensions/no-debug-non-zts-20060613/gd.so/opt/php/ext
修改php.ini文件加载gd组件,添加extension_dir=/opt/php/ext和extension=gd.so,如果有extension_dir=/opt/php/ext则不需要增加
Java代码
extension_dir=/opt/php/ext
extension=gd.so
相关:
http://kenneth.ycool.com/index155.html
http://hi.baidu.com/evilrapper/blog/item/eac02852071c7c110cf3e3f2.html
http://hi.baidu.com/%C9%BD%BA%D3%D2%BB%C3%CE/blog/item/5defc93d3a607edc9e3d62d4.html