首頁  >  文章  >  後端開發  >  linux下为php添加GD库的安装步骤

linux下为php添加GD库的安装步骤

WBOY
WBOY原創
2016-07-25 08:55:191481瀏覽
  1. tar zxvf zlib-1.2.3.tar.gz
  2. cd zlib-1.2.3
  3. ./configure --prefix=/usr/local/zlib
  4. make
  5. make install
复制代码

2,安装libpng

  1. tar zxvf libpng-1.2.8.tar.tar
  2. cd libpng-1.2.8
  3. mv ./scripts/makefile.linux ./makefile
  4. make
  5. make install
复制代码

注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个。 3,安装freetype

  1. tar zxvf freetype-2.1.10.tar.gz
  2. cd freetype-2.1.10
  3. ./configure --prefix=/usr/local/freetype
  4. make
  5. make install
复制代码

4,安装Jpeg

  1. tar zxvf jpegsrc.v6b.tar.gz
  2. cd jpeg-6b/
  3. ./configure --enable-shared
  4. make
  5. make test
  6. make install
复制代码

注意,configure一定要带--enable-shared参数,否则不会生成共享库。

5,安装GD库

  1. tar zxvf gd-2.0.33.tar.gz
  2. cd gd-2.0.33
  3. ./configure --with-png --with-jpeg --with-freetype=/usr/local/freetype
  4. make
  5. make install
复制代码

6,重新编译PHP

  1. tar zxvf php-4.3.9.tar.gz
  2. cd php-4.3.9
  3. ./configure (以前的参数) --with-gd --enable-gd-native-ttf --with-zlib-dir=/usr/local/zlib --with-png --with-jpeg --with-freetype-dir=/usr/local/freetype
  4. make
  5. make install
复制代码

以上用到的库文件的下载地址: 1、gd库下载:http://www.libgd.org/releases/ 2、zlib库下载: http://www.zlib.net/ 3、libpng库下载:http://www.libpng.org/pub/png/libpng.html 4、freetype下载:http://ftp.twaren.net/Unix/NonGNU/freetype/ 5、jpeg7下载:http://download.chinaunix.net/download.php?id=28882&ResourceID=5095



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