Support for adding the GD library to PHP
1. Install the zlib, the general CentOS system comes with the installation, you can use the following command to view:
[Root@test-web2 ~]# Rpm-qa | grep zlib
zlib-1.2.1.2-1.2
zlib-devel-1.2.1.2-1.2
You have new mail in/var/spool/mail/root
[Root@test-web2 ~]#
Some words will not have to install, do not manually download the compilation: http://sourceforge.net/projects/zlib/
Tar zxvf zlib-1.2.2.tar.gz (version own pick, not so-called)
?? CD zlib-1.2.2
??. /configure
?? Make?
?? Make install
2. Installing libpng
http://sourceforge.net/projects/libpng/
Tar zxvf Libpng-1.4.2.tar.tar
?? CD libpng-1.4.2
./configure
?? Make
?? Make install
3. Installing FreeType
http://sourceforge.net/projects/freetype/
Tar zxvf freetype-2.3.12.tar.gz
?? CD freetype-2.3.12
??. /configure
? Make
?? Make install
4. Install JPEG
http://www.ijg.org/
? tar zxvf jpegsrc.v8b.tar.gz
?? CD jpeg-8b/
??. /configure--enable-shared
?? Make
?? Make Test
?? Make install
Note that this configure must take the--enable-shared parameter, otherwise, the shared library will not be generated
5. Install GD
Http://download.chinaunix.net/download/0004000/3479.shtml
Gd-2.44.tar.gz will not install, ^_^
Change back to Gd-2.0.33.tar.gz
Tar zxvf gd-2.0.33.tar.gz?
?? CD gd-2.0.33
??. /configure--with-png--with-freetype--with-jpeg
Make
?? Make install
6. Install PHP
Php-5.2.11.tar.gz
? tar zxvf php-5.2.11.tar.gz
?? CD php-5.2.11
??. /configure options See below
? Make
?? Make install
Note:
/usr/local/include/freetype2/freetype
FreeType
/usr/local/include/include
T1lig
/usr/local/include/libpng14/
Png
/usr/local/include
Jpeg
[Root@test-web2 php-5.2.11]#./configure--help | grep t1lib
? --with-t1lib[=dir]??????? Gd:include t1lib Support. T1lib version >= 5.0.0 required
[Root@test-web2 php-5.2.11]#./configure--help | grep png
? --with-png-dir[=dir]????? Gd:set the path to libpng install prefix
[Root@test-web2 php-5.2.11]#./configure--help | grep jpeg
? --with-jpeg-dir[=dir]???? Gd:set the path to libjpeg install prefix
[Root@test-web2 php-5.2.11]#./configure--help | grep FreeType
? --with-freetype-dir[=dir] Gd:set the path to freetype 2 install prefix
[Root@test-web2 php-5.2.11]#
./configure--PREFIX=/OPT/PHP5--with-apxs2=/opt/apache/bin/apxs--with-mysql=/usr/local/mysql-- With-config-file-path=/opt/php5/lib--with-gd--with-zlib--with-png-dir=/usr/local/include/libpng14/? --with-jpeg-dir=/usr/local/include? --with-freetype-dir=/usr/local/include/freetype2/freetype? (--with-t1lib--with-t1lib-dir=/usr/local/include/include)
Finally, only t1lib support is not enabled.
The GD library support is finally as follows:
Gd
GD support? Enabled??
GD Version? Bundled (2.0.34 compatible)??
FreeType support? Enabled??
FreeType Linkage? With FreeType??
FreeType Version? 2.3.12??
GIF Read support? Enabled??
GIF Create support? Enabled??
JPG support? Enabled??
PNG support? Enabled??
WBMP support? Enabled??
XBM support? Enabled
?
In the Apache configuration file, add the following:
Listen 81
#
# Dynamic Shared Object (DSO) support
#
# to is able to use the functionality of a module which is built as a DSO you
# The corresponding ' LoadModule ' lines at the
# directives contained in it is actually available _before_ they is used.
# statically compiled modules (those listed by ' httpd-l ') does not need
# to is loaded here.
#
# Example:
# LoadModule Foo_module modules/mod_foo.so
LoadModule php5_module??????? Modules/libphp5.so
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
#
?
Create the following files in the Htdocs folder info.php
[Root@test-web2 apache]# cat htdocs/info.php?
? Echo phpinfo ();
?>
[Root@test-web2 apache]#
Can query the case of GD library support.