Learn dynamic web skills PHP: detailed explanation of the GD Library installation title

Source: Internet
Author: User
Tags uncompress
For ease of installation, I wrote about the GD installation process. I hope my friends will give me more comments. thank you! Originally, GD did not support WBMP, and now expanded GD to support WBMP.

Use php to support 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 did not support WBMP, and now expanded GD to support WBMP.

Title:

After RedHat 7.2 is installed, PHP programming is performed. the invention can only process GIF images, but not JPEG images.

Later, I learned that PHP processed images and applied the GD Library. at the beginning, the GD library supported GIF. However, because GIF applied the copyrighted LZW algorithm, it caused legal titles, 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 see support for GIF, PNG, and JPEG at the same time. In the ascending order, Jpeg> ttf> zlib> png> GD> PHP> Apache.

1. installation and configuration of ipv6b

Important 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.

Enter the/usr/src directory to start the installation process. Inbound/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 first describes how to install Jpeg, just follow the instructions. Configure the native Makefile file:

./Configure

After the command is complete, multiple Makefile files are added to the directory. Makefile is a lot of software compilation, installation configuration and process control files, very important, should 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, installation configuration and process control files, very important, should 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

Important GD files 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 to see many people who want GD to support both GIF and JPEG, so someone has made a patch, added 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. Inbound/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 also modified accordingly. Enter this subdirectory:

Cd gd-1.8.3

By default, the GD library does not support JPEG compilation, and the Makefile file must be modified. 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.

Install php apache using the SO method:

6. installation and configuration of php-4.0.6

Important 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.

Enter 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

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.