從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' \
"$@"