Learn dynamic web technology PHP: GD Library installation question _ PHP Tutorial

Source: Internet
Author: User
Tags uncompress
Learn dynamic web technology PHP: detailed explanation of GD Library installation issues. 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. q: For the convenience of installing Red, I wrote the GD installation process and published it now. 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 dont 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 thats 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:

Success! In the past, GD did not support WBMP, but now expanded GD to support WBMP. problem: install Red...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.