从php5后GD已经加入到扩展库中,除非系须要更高级的版本,若是没有特殊须要,能够直接使用gd,编译时加上如下的选项php
'--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的源码目录下mysql
vi ./config.nice
将会看到
类形似这样的编译条件,这是上一次的成功编译的条件sql
#! /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,如下是最后的编译代码apache
#! /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' \ "$@"