从php5后GD已经加入到扩展库中,除非系需要更高级的版本,如果没有特殊需要,可以直接使用gd,编译时加上以下的选项
'--with-gd'
'--enable-exif'
'--enable-gd-native-ttf'
'--with-zlib'
'--with-png-dir'
'--with-jpeg-dir'
'--with-freetype-dir'
'--with-ttf'
'--with-gettext=/usr/lib'
'--enable-gd-jis-conv'
具体的安装apache php mysql gd的方法可以在gg上搜索。
由于我已经这安装了好了php跟GD,但是当时是没有支持freetype不能在图片上写文字。
因为现在需要在图片上写文字。重新编译php,但很多人像我这样的已经安装了GD但原来未有支持freetype,或者其它的某些功能,但加上以下的选项重新编译后,还不能使用新功能,就需要在源代码的目录中运行make clean,然后再运行编译程序
进入到原来安装php的源码目录下
vi ./config.nice
将会看到
类形似这样的编译条件,这是上一次的成功编译的条件
#! /bin/sh
#
# Created by configure
'./configure'
'--with-mysql=/usr/local/mysql'
'--with-apxs2=/usr/local/apache/bin/apxs'
'--with-gd'
'--enable-exif'
'--enable-gd-native-ttf'
'--enable-inline-optimization'
'--with-zlib'
'--with-png-dir'
'--with-jpeg-dir'
'--enable-mbstring'
'--with-gettext=/usr/lib'
'--enable-gd-jis-conv'
"$@"
我顺便升级了一下jpeg6,png,zlib,以下是最后的编译代码
#! /bin/sh
#
# Created by configure
'./configure'
'--with-mysql=/usr/local/mysql'
'--with-apxs2=/usr/local/apache/bin/apxs'
'--with-gd'
'--enable-exif'
'--enable-gd-native-ttf'
'--enable-inline-optimization'
'--with-zlib=/usr/local/zlib'
'--with-png-dir=/usr/local/libpng'
'--with-jpeg-dir=/usr/local/jpeg6'
'--with-freetype-dir=/usr/local/freetype'
'--with-ttf'
'--enable-mbstring'
'--with-gettext=/usr/lib'
'--enable-gd-jis-conv'
"$@"