Home >Backend Development >PHP Tutorial >Detailed explanation of the steps to add GD library support to PHP

Detailed explanation of the steps to add GD library support to PHP

WBOY
WBOYOriginal
2016-07-25 08:55:141009browse
  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
If the copied code

does not exist, please download and compile it 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 the 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 the 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 configure must have the --enable-shared parameter here, 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. ./Configure options are shown below

  4. make

  5. make install< ;/p>
Copy code

Note:

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

  2. freetype

  3. /usr/local/include/include

  4. t1lig

  5. png

  6. /usr/local/include

  7. jpeg

  8. [root@jbxue php-5.2.11]# . /configure --help | grep t1lib

  9. --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required
  10. [root@jbxue php-5.2.11]# ./configure -- help | grep png
  11. --with-png-dir[=DIR] GD: Set the path to libpng install prefix
  12. [root@jbxue php-5.2.11]# ./configure --help | grep jpeg
  13. --with -jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix
  14. [root@jbxue php-5.2.11]# ./configure --help | grep freetype
  15. --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
  16. [root@jbxue php-5.2.11]#

  17. ./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

In the end, only T1Lib Support is not enabled.

GD library support is finally as follows:

  1. Listen 81

  2. #
  3. # Dynamic Shared Object (DSO) Support
  4. #
  5. # To be able to use the functionality of a module which was built as a DSO you
  6. # have to place corresponding `LoadModule' lines at this location so the
  7. # directives contained in it are actually available _before_ they are used.
  8. # Statically compiled modules (those listed by `httpd -l') do not need
  9. # to be 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 the test file info.php in the htdocs directory:

  1. [root@jbxue apache]# cat htdocs/info.php
  2. echo phpinfo();
  3. ?>
Copy the code

Then, visit it in the browser This file can be used to query the GD library support.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn