PHP Add GD library support steps in detail

Source: Internet
Author: User
    1. [Root@jbxue ~]# Rpm-qa | grep zlib
    2. zlib-1.2.1.2-1.2
    3. zlib-devel-1.2.1.2-1.2
    4. You have new mail in/var/spool/mail/root
Copy Code

If it does not exist, please download the compilation manually: Http://ishare.iask.sina.com.cn/f/15275772.html

    1. Tar zxvf zlib-1.2.2.tar.gz
    2. CD zlib-1.2.2
    3. ./configure
    4. Make
    5. Make install
Copy Code

2, install libpng http://sourceforge.net/projects/libpng/

    1. Tar zxvf Libpng-1.4.2.tar.tar
    2. CD libpng-1.4.2
    3. ./configure
    4. Make
    5. Make install
Copy Code

3. Install FreeType http://sourceforge.net/projects/freetype/

    1. Tar zxvf freetype-2.3.12.tar.gz

    2. CD freetype-2.3.12

    3. ./configure

    4. Make
    5. Make install

Copy Code

4. Install JPEG http://www.ijg.org/

    1. Tar zxvf jpegsrc.v8b.tar.gz

    2. CD jpeg-8b/

    3. ./configure--enable-shared

    4. Make
    5. Make Test
    6. Make install
Copy Code

Note that this configure must take the--enable-shared parameter, otherwise the shared library will not be generated.

5, install GD https://bitbucket.org/pierrejoye/gd-libgd/downloads

    1. Tar zxvf gd-2.0.33.tar.gz

    2. CD gd-2.0.33
    3. ./configure--with-png--with-freetype--with-jpeg

    4. Make

    5. Make install

Copy Code

6, install PHP php-5.2.11.tar.gz

    1. Tar zxvf php-5.2.11.tar.gz

    2. CD php-5.2.11
    3. The./configure option is shown below

    4. Make

    5. Make install

Copy Code

Note:

  1. /usr/local/include/freetype2/freetype

  2. FreeType

  3. /usr/local/include/include

  4. T1lig

  5. /usr/local/include/libpng14/

  6. Png

  7. /usr/local/include

  8. Jpeg

  9. [Root@jbxue php-5.2.11]#./configure--help | grep t1lib

  10. --with-t1lib[=dir] Gd:include t1lib support. T1lib version >= 5.0.0 required
  11. [Root@jbxue php-5.2.11]#./configure--help | grep png
  12. --with-png-dir[=dir] Gd:set The path to libpng install prefix
  13. [Root@jbxue php-5.2.11]#./configure--help | grep jpeg
  14. --with-jpeg-dir[=dir] Gd:set The path to libjpeg install prefix
  15. [Root@jbxue php-5.2.11]#./configure--help | grep FreeType
  16. --with-freetype-dir[=dir] Gd:set the path to freetype 2 install prefix
  17. [Root@jbxue php-5.2.11]#

  18. ./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)

Copy Code

Finally, only t1lib support is not enabled.

The GD library support is finally as follows:

    1. Listen 81

    2. #
    3. # Dynamic Shared Object (DSO) support
    4. #
    5. # to is able to use the functionality of a module which is built as a DSO you
    6. # The corresponding ' LoadModule ' lines at the
    7. # directives contained in it is actually available _before_ they is used.
    8. # statically compiled modules (those listed by ' httpd-l ') does not need
    9. # to is loaded here.
    10. #
    11. # Example:
    12. # LoadModule Foo_module modules/mod_foo.so
    13. LoadModule Php5_module modules/libphp5.so

    14. AddType application/x-httpd-php. php

    15. AddType Application/x-httpd-php-source. Phps
    16. #

Copy Code

Create a test file in the Htdocs directory info.php:

    1. [Root@jbxue apache]# Cat htdocs/info.php
    2. Echo Phpinfo ();
    3. ?>
Copy Code

Then, access the file in the browser to query the GD library support.

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