1: Install the GD dependency pack
Yum-y Install GD gd2 gd-devel gd2-devel zlib freetype
To install JPEG:
wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz
TAR-XVF jpegsrc.v9b.tar.gz
./configure--prefix=/usr/local/jpeg--enable-shared--enable-static
Make && make install
2: Enter PHP extended directory compilation extension
cd PHP source Pack/ext//ext/gd For example:/USR/LOCAL/SRC/PHP-5.5.37/EXT/GD
Executive:/usr/local/php/bin/phpize
Compiling GD extensions:
./configure--with-php-config=/usr/local/php/bin/php-config-with-png-dir--with-freetype-dir--with-jpeg-dir=/usr /local/jpeg-with-zlib-dir--WITH-GD
Make
Make install
This will prompt: Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212 (this path is the extended path)
cd/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212
You can see the extension: The gd.so extension has been compiled successfully
3: The compiled GD extension is added to PHP
Open php.ini
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212"//Set extension path
extension=gd.so//Add GD extension
4: Problems encountered in compiling
The first time I compiled:./configure--with-php-config=/usr/local/php/bin/php-config--with-jpeg=/usr/local/jpeg--with-png-- With-freetype--with-zlib--WITH-GD
Then after compiling the installation installation, the GD extension was found to be successful, but some of the built-in functions in PHP didn't work.
Replace the one above: remember to make clean or the change will fail
--with-freetype and--with-freetype-dir differences: