Steps to install and open the PHP GD library under Redhat

Source: Internet
Author: User
How to install and open PHP GD library under Redhat
The GD library is an important library for PHP to manipulate graphics and text. The Red Hat system is suitable for installation with compilation. The specific steps are as follows:

1. Preparatory work:

The required software is: Zlib-1.2.7.tar,libpng-1.2.40.tar,jpeg-6b.tar,freetype-2.3.5.tar,gd-2.0.33.tar

Package Download Address: http://pan.baidu.com/share/link?shareid=452677&uk=3240790330

Decompression Password: d5475sf45ffdf54 (software finishing, turn from the Jade Pooy)

or category download:
Http://google-desktop-for-linux-mirror.googlecode.com/files/gd-2.0.35.tar.gz
Http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz
Ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.2.tar.gz
Http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
Http://down1.chinaunix.net/distfiles/freetype-1.3.1.tar.gz
Http://down1.chinaunix.net/distfiles/gettext-0.16.1.tar.gz


2, installation Zlib

Tar xvzf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure  --prefix=/usr/local/zlibmake && make install


3, installation FreeType

Tar xvzf freetype-1.3.1.tar.gzcd freetype-1.3.1./configure--prefix=/usr/local/freetypemake && make install


4, installation libpng

Tar xvzf libpng-1.5.2.tar.gzcd libpng-1.5.2./configure--prefix=/usr/local/libpng make && make install


5, Installation Jpegsrc

Tar xvzf jpegsrc.v6b.tar.gzcd jpegsrc.v6b./configure--prefix=/usr/local/jpeg6  --enable-shared-- Enable-staticmake && make Install


Possible error: The prompt folder does not exist, should be the program can not automatically create folders, according to the error of the prompt, hand-use mkdir create files on it.

This time for example:
Mkdir-p/usr/local/jpeg6/include/mkdir-p/usr/local/jpeg6/lib/mkdir-p/usr/local/jpeg6/bin/cjpegmkdir-p/usr/local /jpeg6/man/man1/


6, install GetText (some directly have, you can install the GD library, error and then return to install)

Tar xvzf gettext-0.16.1.tar.gzcd gettext-0.16.1./configure--prefix=/usr/local/gettextmake && make install


7. Installing GD

Tar xvzf gd-2.0.35.tar.gzcd gd-2.0.35./configure--prefix=/usr/local/gd--with-jpeg=/usr/local/jpeg6--with-png=/usr /local/libpng--with-freetype=/usr/local/freetypemake Clean (before compiling this sentence) Makemake install


Configure ... Possible error in this step: configure.ac:64:error:possibly undefined macro:am_iconv, this must be installed GetText (in step 6)

8. Generate gd.so
Cd.. /php-5.2.17/ext/gd/                # The directory where the downloaded installation package/usr/local/php5/bin/phpize./configure--with-php-config=/usr/local/php/bin/ Php-config--with-jpeg-dir=/usr/local/jpeg6/--with-png-dir=/usr/local/libpng/--with-gd=/usr/local/gd/-- With-freetype=/usr/local/freetype/make Clean (this is done before compiling) make && make install


At the end of make install there will be the location of GD inventory, from that folder to copy gd.so to the extension library directory
Modify PHP.ini

9, add the following content in PHP.ini

Extension=gd.so


10. Recompile PHP

Enter the PHP source directory

./configure--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql--without-sqlite--without-pdo-sqlite--with-gd=/ USR/LOCAL/GD--with-freetype-dir=/usr/local/freetype/make Clean (before compiling this sentence) Makemake install


11. End of installation, restart Apache Service

./httpd-k Restart


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