- gd-2.0.33.tar.gz http://www.boutell.com/gd/
- jpegsrc.v6b.tar.gz http://www.ijg.org/
- libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
- zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
- freetype-2.1.9.tar.gzhttp://sourceforge.net/projects/freetype/
- php-4.3.9.tar.gz http://www.php.com
二、安装
1.安装zlib
- tar zxvf zlib-1.2.2.tar.gz
- cd zlib-1.2.2
- ./configure
- make
- make install
2.安装libpng
- tar zxvf libpng-1.2.7.tar.tar
- cd libpng-1.2.7
- cd scripts/
- mv makefile.linux ../makefile
- cd ..
- make
- make install
-
注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个
3.安装freetype
- tar zxvf freetype-2.1.9.tar.gz
- cd freetype-2.1.9
- ./configure
- make
- make install
4.安装Jpeg
- tar zxvf jpegsrc.v6b.tar.gz
- cd jpeg-6b/
- ./configure --enable-shared
- make
- make test
- make install
-
注意,这里configure一定要带--enable-shared参数,不然,不会生成共享库
5.安装GD
- tar zxvf gd-2.0.33.tar.gz
- cd gd-2.0.33
- ./configure --with-png --with-freetype --with-jpeg
- make install
上面的安装步骤是没有设定 安装目录的,测试重新编译PHP时用上面方法均可。
若要指定安装地址,请采用如下方式,推荐定义安装目录。
1、安装 zlib
- wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz
- tar -zxf zlib-1.2.3.tar.gz
- cd zlib-1.2.3
- ./configure –prefix=/usr/local/zlib
- make
- make install
-
2、安装 jpeg
- wget ftp://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 -zxf jpeg-6b.tar.gz
- cd jpeg-6b
- ./configure –prefix=/usr/local/jpeg6 –enable-shared –enable-static
- make
- make install
-
安装完成提示:
Libraries have been installed in:
/usr/local/jpeg6/lib
3、安装 libpng
- wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz
- tar -zxf libpng-1.2.16.tar.gz
- cd libpng-1.2.16
- ./configure –prefix=/usr/local/libpng
- make
- make install
-
4、安装 freetype
- wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gz
- tar -zxf freetype-2.3.4.tar.gz
- cd freetype-2.3.4
- mkdir -p /usr/local/freetype
- ./configure –prefix=/usr/local/freetype
- make
- make install
-
5、安装 GD
- wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gz
- tar -zxf gd-2.0.33.tar.gz
- cd gd-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
- make install
-
安装jpg时,如果出错,需要先装libtool:
libtool-1.X.tar.gz //是我下载的版本
- ./configure
- make
- make 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 recognized
checking build system type… Invalid configuration `x86_64-unknown-linux-gnu ‘: machine `x86_64-unknown ‘ not recognized
configure: error: libtool configure failed
或者
/libtool --mode=compile gcc -O2 -I. -c ./jcapimin.c
make: ./libtool:命令未找到
make: *** [jcapimin.lo] 错误 127
./libtool --mode=compile gcc -O2 -I. -c ./cjpeg.c
make: ./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-static
make
make install
--------------------------------
如果已经安装php,建议通过追加编译安装
进入“[php解压目录]/ext/gd”目录,执行如下命令:
[php安装目录]/bin/phpize
./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
make 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则不需要增加
extension_dir=/opt/php/ext
extension=gd.so |