复制代码
3、安装freetype
# tar xvzf freetype-1.3.1.tar.gz# cd freetype-1.3.1# ./configure --prefix=/usr/local/freetype# make && make install
复制代码
有多行错误类似:ftdump.c:172:1: error: pasting . and glyph_object does not give a valid preprocessing token
解决方法:修改 test/ftdump.c 里面的代码:将 print_mem( memory_footprint.##field, string ) 改为: print_mem( memory_footprint.field, string )将 #define footprint( field ) save_memory( &memory_footprint.##field ) 改为: #define footprint( field ) save_memory( &memory_footprint.field )重新make && make install或修改makefile.in:
1. 去掉all: ttlib tttest ttpo中的tttest2. 删除install: cd $(ftlibdir); $(make) -f $(makefile) install cd $(fttestdir); $(make) -f $(makefile) install cd $(ftpodir); $(make) install中的 cd $(fttestdir); $(make) -f $(makefile) install# ./configure --prefix=/usr/local/freetype# make && make install
复制代码
4、安装libpng
# tar xvzf libpng-1.5.2.tar.gz# cd libpng-1.5.2# ./configure --prefix=/usr/local/libpng# make && make install
复制代码
5、安装jpegsrc
# tar xvzf jpegsrc.v6b.tar.gz# cd jpegsrc.v6b# ./configure --prefix=/usr/local/jpeg6 –enable-shared –enable-static# make && make install
复制代码
可能的错误:提示文件夹不存在,应该是程序不能自动创建文件夹吧,根据提示的错误,手动用mkdir创建文件就可以了。本次例如:
# mkdir -p /usr/local/jpeg6/include/# mkdir -p /usr/local/jpeg6/lib/# mkdir -p /usr/local/jpeg6/bin/cjpeg# mkdir -p /usr/local/jpeg6/man/man1/
复制代码
6、安装gettext(有的直接就有,可以先安装gd库,报错再返回来安装)
# tar xvzf gettext-0.16.1.tar.gz# cd gettext-0.16.1# ./configure --prefix=/usr/local/gettext# make && make install
复制代码
7、安装gd库
# tar xvzf gd-2.0.35.tar.gz# cd gd-2.0.35# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype# make# make install
复制代码
configure...这一步可能的错误:configure.ac:64: error: possibly undefined macro: am_iconv,这个就必须安装gettext(步骤6中有讲)
8、生成gd.so
# cd ../php-5.2.17/ext/gd/#/usr/local/php5/bin/phpize#./configure --with-php-config=/usr/local/php5/bin/php-config --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd/ --with-freetype-dir=/usr/local/freetype/# make && make install
复制代码
这时在make install的结尾会有gd库存放的位置,从那个文件夹中将gd.so复制到扩展库目录中
9、修改php.ini在php.ini中添加如下内容
extension=gd.so
复制代码
10、安装结束,重启apache服务
# service httpd restart
复制代码
