Because before all through the source code directly installed lamp environment, so many expansion libraries are not installed, suddenly now to use a verification code class, Imagecreate function display is undefined, so to install the compiled GD library,
First, you need to install the GD front-facing library: FreeType, Jpegsrc,libpng.
FreeType
wget "http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2" Tar jxvf freetype-2.4.0.tar.bz2cd Freetype-2.4.0./configure--prefix=/usr/local/freetype && make && make install
Jpegsrc
wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz" tar zxvf jpegsrc.v9.tar.gzcd jpeg-9 cflags= "-o3-fpic". Configure--prefix=/usr/local/jpeg && make && make installmkdir-p/usr/local/jpeg/includemkdir-p/usr/ Local/jpeg/libmkdir-p/usr/local/jpeg/binmkdir-p/usr/local/jpeg/man/man1
Libpng
wget "http://ufpr.dl.sourceforge.net/project/libpng/libpng12/1.2.56/libpng-1.2.56.tar.gz" tar zxvf LIBPNG-1.2.50.TAR.GZCD libpng-1.2.56cflags= "-o3-fpic"./configure--prefix=/usr/local/libpng && Make & & Make Install
After the install succeeds, go to the PHPSRC directory, which is the source package you downloaded previously
cd/home/daneil/downloads/php.5.3.x //You download PHP version cd/etx/gd// Enter the GD folder
In this directory to execute phpize, using the Phpize case, when we need to add more modules, and do not want to recompile PHP, these we can use the phpize. My PHP is installed in the/usr/local/php/directory, can be modified according to personal circumstances.
./configure--with-php-configure=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg -- With-png-dir=/usr/local/libpng
--with-freetype-dir=/usr/local/freetype
Then modify the php.ini file to add a line under; Extension=php_gd2.dll extension=gd.so
Input/usr/local/php/bin/php-m//load Module
So you can. Then reboot Apache to be OK!
Reference Blog: http://www.nowamagic.net/librarys/veda/detail/2610
Linux through the source code to compile the GD library