GD library Installation PM Author: ihero From: a library of Linux knowledge Current: http://www.douzhe.com/linuxtips/913.html Address: Unknown Make PHP support for GIF, JPEG, TTF, and wbmp For ease of installation, I wrote about the GD installation process. I hope my friends will give me more comments. Thank you! Originally, GD does not support wbmp, And now expanded GD supports wbmp. Problem: After RedHat 7.2 is installed, PHP programming is performed. Only GIF images can be processed, but JPEG images cannot be processed. Later, I learned that PHP used the GD library to process images, and the GD library started to support GIF. However, because GIF uses the copyrighted LZW algorithm, it may cause legal problems, so from the beginning of the GD-1.6, GD library no longer support GIF, changed to support better, no copyright dispute PNG. Now I want to support both GIF, PNG and JPEG. This section describes the bottom-up sequence, namely JPEG-> TTF-> zlib-> PNG-> Gd-> PHP-> Apache. 1. installation and configuration of ipv6b Main JPEG files include jpeglib. H, libjpeg. A, and libjpeg. So. First, check whether the image is installed. Check whether the image Lib. H is installed in the/usr/include directory. Check whether the image libjpeg. A and libjpeg. So are available in the/usr/include directory. I do not have it in my system, so I need to install it. The URL for obtaining JPEG source code is: Ftp://ftp.uu.net/graphics/jpeg/ The obtained file is src.v6b.tar.gz, which is stored in the/usr/src directory. Go to the/usr/src directory and start the installation process. Enter/usr/src: CD/usr/src Uncompress the file: Tar xzvf restart src.v6b.tar.gz After the command is completed, a sub-directory jpeg-6b is added, and the source file of JPEG is in it. Enter this subdirectory: CD jpeg-6b The install.doc file in this directory describes in detail how to install JPEG, just follow the instructions. Configure to generate the MAKEFILE file: ./Configure After the command is complete, multiple makefile files are added to the directory. Makefile is a lot of software compilation and installation configuration and process control files, it is very important to learn to understand its content. Start Compilation: Make After the command is complete, many files are added to the directory, including libjpeg. A and libjpeg. So. Installation: Make install After the command is complete, jpeglib. H is copied to the/usr/include directory, and libjpeg. A and libjpeg. So are copied to the/usr/local/lib directory. 2. TTF installation and configuration Http://www.freetype.org Freetype-1.3.1.tar.gz Tar-xzvf freetype-1.3.1.tar.gz ./Configure After the command is complete, multiple makefile files are added to the directory. Makefile is a lot of software compilation and installation configuration and process control files, it is very important to learn to understand its content. Start Compilation: Make Make install Error don't found the FreeType. h occurs during GD compilation. CP/usr/local/include/FreeType/*/usr/local/include/ 3. Install zlib: Becaust the note, you must install the zlib first! Before installing LibPNG, you must first install zlib. zlib Can usually be found wherever you got LibPNG. zlib can be Placed in another directory, at the same level as LibPNG. Note that your system might already have a preinstalled Zlib, but you will still need to have access to Zlib. h and zconf. h include files that correspond to Version of zlib That's installed. Http://www.gzip.org/zlib/ Ftp://ftp.uu.net/graphics/png/src/zlib-1.1.3.tar.gz ./Configure Make Make install 4. libpng installation: Read install Http://www.libpng.org/pub/png/ Libpng-1.2.0.tar.gz UNIX example: CP scripts/makefile. STD makefile Make Make install 5. installation and configuration of GD-1.8.3 The main files of GD include GD. h and libgd.. The address for getting GD source code is: http://www.boutell.com/gd/ The obtained file is gd-1.8.3.tar.gz, which is stored in the/usr/src directory. I already know that GD of this version does not support GIF, But I want many people who want GD to support both GIF and JPEG, so someone has made a patch, added the support for GIF. It looks like an English man. His e-mail address is adam@elysium.ltd.uk. Get the address of the patch source code: The http://www.webofsin.com/gd-1.8.3-gif.patch to get the file is gd-1.8.3-gif.patch, put in the/usr/src directory. Enter/usr/src: CD/usr/src Uncompress the file: Tar xzvf gd-1.8.3.tar.gz After the command is completed, a sub-directory gd-1.8.3 is added, and the source code file of GD is in it. Patch the source code: Patch-P0 After the command is complete, there are multiple gd_gif.c files in the gd-1.8.3 subdirectory, and the files GD. h and makefile are modified accordingly. Enter this subdirectory: CD gd-1.8.3 By default, the GD library does not support JPEG compilation. You must modify the MAKEFILE file. Modify the MAKEFILE file so that: Cflags =-o-dhave_xpm-dhave_jpeg-dhave_libttf Libs =-lm-LGD-lpng-LZ-ljpeg-lttf-lxpm-lx11 After that, compile and install: Make Make install After the command is complete, Gd. H is copied to the/usr/local/include directory, and libgd. A is copied to the/usr/local/lib directory. PHP Apache is installed in so mode: 6. installation and configuration of php-4.0.6 The main PHP files include libphp4.a and libphp4.so. Get PHP Source Code address: http://php.net The obtained file is php-4.0.6.tar.gz, which is stored in the/usr/src directory. Go to the/usr/src directory and decompress the file: CD/usr/src Tar xzvf php-4.0.6.tar.gz After the command is completed, a sub-directory php-4.0.6 is added, and the PHP source code file is in it. Enter this subdirectory: CD php-4.0.6 PHP ./Configure -- With-Apache =/usr/local/apache_1.3.26 -- Enable-track-vars -- Enable-Debug -- Enable-URL-includes -- Enable-sockets -- With-Gd =/usr/local -- Enable-Gd-native-TTF -- With-TTF =/usr/local -- With-JPEG-Dir =/usr/local -- With-zlib-Dir =/usr/local -- With-PNG-Dir =/usr/local Compile and install: Make Make install After the command is complete, libphp4.so is copied to the/usr/lib/Apache directory. 7. installation and configuration of apache_1.3.12 ./Configure -- Prefix =/usr/local/Apache -- Activate-module = src/modules/PhP4/libphp4.a -- Enable-module = so -- Enable-module = negotiation -- Enable-module = Status -- Enable-module = include -- Enable-module = Autoindex -- Enable-module = CGI -- Enable-module = Asis -- Enable-module = IMAP -- Enable-module = actions -- Enable-module = userdir -- Enable-module = alias -- Enable-module = setenvif Make Make install
|