首頁  >  文章  >  後端開發  >  PHP新增GD庫支援的步驟詳解

PHP新增GD庫支援的步驟詳解

WBOY
WBOY原創
2016-07-25 08:55:14985瀏覽
  1. [root@jbxue ~]# rpm -qa | grep zlib
  2. zlib-1.2.1.2-1.2
  3. zlib-devel-1.2.1.2-1.22.
  4. You have new mail in /var/spool/mail/root
複製程式碼

不存在的話,請手動下載編譯: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. ./configure
make
./configure make ./configure
make

./configure

make
make install
  1. 複製程式碼
  2. 2,安裝libpng http://sourceforge.net/projects/libpng/
tar zxvf libpng-1.4.2.tar.tar
cd libpng-1.4.2

./configure

cd libpng-1.4.2
./configure
make > make install
  1. 複製程式碼
  2. 3.安裝freetype http://sourceforge.net/projects/freetype/

tar zxvf freetype-2.3.12.tar.gz

cd freetype-2.3.12

./configure

make
make install
  1. 複製程式碼
  2. 4,安裝Jpeg http:/ /www.ijg.org/

tar zxvf jpegsrc.v8b.tar.gz cd jpeg-8b/

./configure --enable-shared

make

make test

make install

    複製代碼
  1. 注意,這裡configure一定要帶--enable-shared參數,不然,不會產生共用函式庫。
  2. 5,安裝GD https://bitbucket.org/pierrejoye/gd-libgd/downloads

tar zxvf gd-2.0.33.tar.gz

cd gd-2.0.33

./configure --with-png --with-freetype --with-jpeg

make

make install
  1. 複製程式碼
  2. 6,安裝PHP php-5.2.11.tar.gz

tar zxvf php-5.2.11.tar.gz

cd php-5.2.11

./configure選項請見下方

make

make install
  1. 複製程式碼
  2. 註:
  3. /usr/local/include/freetype2/freetype

  4. freetype
  5. /usr /local/include/include

  6. t1lig
  7. /usr/local/include/libpng14/

  8. png
  9. /usr/local/include

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

--with-t1lib[=DIR] GD: Include T1lib support . T1lib version >= 5.0.0 required
[root@jbxue php-5.2.11]# ./configure --help | grep png --with-png-dir[=DIR] GD: Set the path to libpng install prefix[root@jbxue php-5.2.11]# ./configure --help | grep jpeg
--with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix

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

--with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix

[root@jbxue php-5.2.11]#

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

  1. 複製程式碼
  2. 最後只有T1Lib Support沒有啟用。
  3. GD庫支援最終如下:
  4. Listen 81

  5. #
  6. # Dynamic Shared Object (DSO) Support
  7. #
  8. # Dynamic Shared Object (DSO) Support
  9. #
  10. # be able to use the functionality of a module which was built as a DSO you
  11. # have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are peru. 🎜># Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.## Example:
# LoadModuo_# LoadModua. 🎜>LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps# p>

複製程式碼

在htdocs目錄中建立測試檔案info.php:

  1. [root@jbxue apache]# cat htdocs/info.php
  2. echo phpinfo();
  3. ?
複製程式碼

然後,在瀏覽器中存取該文件,可查詢GD庫支援的情況。



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn