GDのインストール Ver.2.1.0

 必須ライブラリ インストール
libpng
libjpeg
Freetype2
fontconfig

# yum install libpng-devel libjpeg-devel freetype-devel gettext-devel
# yum install xpm-devel
# yum install libxml2-devel
# yum install libXpm-devel


 libpng
# wget http://prdownloads.sourceforge.net/libpng/libpng-1.5.4.tar.gz?download
# tar zxvf libpng-1.5.4.tar.gz
# cd libpng-1.5.4
# ./configure --prefix=/usr/local
# make
# make install
http://www.libpng.org


 libjpeg
# wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
# tar zxvf jpegsrc.v8c.tar.gz
# cd jpeg-8c
# ./configure --prefix=/usr/local
# make
# make install
http://www.ijg.org


 Freetype2
# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.4.tar.gz
# tar zxvf freetype-2.4.4.tar.gz
# cd freetype-2.4.4
# ./configure --prefix=/usr/local
# make
# make install
http://freetype.sourceforge.net


 fontconfig
# wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.1.tar.gz
# tar zxvf fontconfig-2.11.1.tar.gz
# cd fontconfig-2.11.1
# ./configure --enable-libxml2
# make
# make install

もしくは
# yum install fontconfig-devel
http://fontconfig.org


 GD インストール
# cd /tmp
# wget https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz
# tar zxvf gd-2.1.0.tar.gz
# cd gd-2.1.0
# ./configure --with-fontconfig=/usr
# make
# make install


 PHP 再コンパイル
# cd /tmp
# wget http://rakunet.jp/linux_files/php-5.2.17.tar.gz
# tar zxvf php-5.2.17.tar.gz
# cd php-5.2.17
# ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-gd=/usr/local \
--with-freetype-dir=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-zlib \
--with-mysql=/usr/local/mysql \
--with-mcrypt
--enable-mbstring \
--enable-mbregex \
--enable-zend-multibyte \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-exif \
--with-xpm-dir=/usr/lib64
# make
# make install


 Apache 再起動
# /usr/local/apache2/bin/apachectl -k graceful


参考
Shinta's PHPでグラフを作ろう!(修正版: gd ライブラリ GIFサポート復活記念


更新 2014.03.27