Linux下安装PHP的GD支持库
-
Linux下安装PHP的GD支持库
1、安装 zlib
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gztar -zxf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure –prefix=/usr/local/zlibmakemake install2、安装 jpeg
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg-6b.tar.gzmkdir -p /usr/local/jpeg6mkdir -p /usr/local/jpeg6/binmkdir -p /usr/local/jpeg6/libmkdir -p /usr/local/jpeg6/includemkdir -p /usr/local/jpeg6/manmkdir -p /usr/local/jpeg6/man1mkdir -p /usr/local/jpeg6/man/man1tar -zxf jpeg-6b.tar.gzcd jpeg-6b./configure –prefix=/usr/local/jpeg6 –enable-shared –enable-staticmakemake install安装完成提示:Libraries have been installed in:/usr/local/jpeg6/lib3、安装 libpng
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gztar -zxf libpng-1.2.16.tar.gzcd libpng-1.2.16./configure –prefix=/usr/local/libpngmakemake install4、安装 freetype
wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gztar -zxf freetype-2.3.4.tar.gzcd freetype-2.3.4mkdir -p /usr/local/freetype./configure –prefix=/usr/local/freetypemakemake install5、安装 GD
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gztar -zxf gd-2.0.33.tar.gzcd gd-2.0.33mkdir -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/makemake install--------------------安装jpg时候,如果出错。先装libtoollibtool-1.X.tar.gz //是我下载的版本./configuremakemake install再装jpegsrc.v6b.tar.gz./configure --enable-shared --enable-static 这些lib这种包用默认路径就行。不然如果其他的需要这个包还得指它的路径这里可能会出错checking host system type… Invalid configuration `x86_64-unknown-linux-gnu ‘: machine `x86_64-unknown ‘ not recognizedchecking build system type… Invalid configuration `x86_64-unknown-linux-gnu ‘: machine `x86_64-unknown ‘ not recognizedconfigure: error: libtool configure failed或者/libtool --mode=compile gcc -O2 -I. -c ./jcapimin.cmake: ./libtool:命令未找到make: *** [jcapimin.lo] 错误 127./libtool --mode=compile gcc -O2 -I. -c ./cjpeg.cmake: ./libtool:命令未找到make: *** [cjpeg.lo] 错误 127解决方法cp /usr/share/libtool/config/config.guess .cp /usr/share/libtool/config/config.sub .cp到jpeg的安装文件目录,注意后面的个“.”make clean再重新./configure --prefix=/usr/local/libjpeg/ --enable-shared --enable-staticmakemake install--------------------------------如果已经安装php,建议通过追加编译安装进入“[php解压目录]/ext/gd”目录,执行如下命令:[php安装目录]/bin/phpizeJava代码./configure --with-php-config=[php安装目录]/bin/php-config --with-jpeg=[jpeg-6b安装目录] --with-png=[libpng安装目录] --with-freetype=[freetype安装目录] --with-gettext=[gettext安装目录] --with-gd=[gd安装目录]makemake install安装成功后会在“[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/extextension=gd.so
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。