==================================
下面才开始安装 GD库,安装gd库成功与否,与下面的安装顺序有一定的关系
我们就一步步来演示安装, 下面所有用到的文件,可以到
http://www.tabcn.cn/download/gd_all.7z下载
把全部的文件 都放进 webserv 目录下
1:安装zlib2
同样, 在Linux下使用 wget 来下载文件
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
---------------------------------
2:安装PNG
tar zxvf libpng-1.2.26.tar.gz
cd libpng-1.2.26
cp scripts/makefile.linux ./makefile
./configure --prefix=/usr/local/libpng
make
make install
---------------------------------
3:安装ttf ( ttf 是字体的支持 )
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
---------------------------------
4:安装JPEG6
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir -pv /usr/local/libjpeg/{,bin,lib,include,man/man1,man1}
上面这个命令具体是实现这样的:
mkdir: created directory `/usr/local/libjpeg'
mkdir: created directory `/usr/local/libjpeg/bin'
mkdir: created directory `/usr/local/libjpeg/lib'
mkdir: created directory `/usr/local/libjpeg/include'
mkdir: created directory `/usr/local/libjpeg/man'
mkdir: created directory `/usr/local/libjpeg/man/man1'
mkdir: created directory `/usr/local/libjpeg/man1'
可以说是一个小小的bug吧,要我们手动建立这些目录,否则configure时候会说找不到目录。
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
make
make install
---------------------------------
5:安装 libxml2
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
./configure --prefix=/usr/local/libxml2
make
这一步make 操作 时间相对也会比较长,呵呵
make install
cp xml2-config /usr/bin
---------------------------------
6:安装 libmcrypt-2.5.7.tar.gz
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make
make install
---------------------------------
7:安装Fontconfig
tar -zxvf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2
可以看到, 参数比较长, 我建议用记事本的朋友不要选择 自动换行。
看我操作, 自动换行 复制过去执行有时会出错。去掉 自动换行
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
这里显示一个错误信息:
checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
No package 'libxml-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
但是我们在上面其实已经安装上 libxml2 了的,这里只是一个 环境变量没有设置好而已。
解决办法: 确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
再次生成 makefile , 这样就成功了
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
好了吧,没有出现那个错误了。
make
make install
---------------------------------
8:安装GD库,我们把这一步放在最后面
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig=/usr/local/fontconfig
看到下面的信息, 呵呵 很多都显示支持了
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for pthreads: yes
make
make install
好了, 到这里为止 安装GD库全部过程演示完了,
这样还是不是很好的感觉出来,等我们下一节视频-
就是把 php5.2.6也装上了,那么才知道 php 支持了 gif jpg png wbmp xml ttf字体
下载相关软件包 http://www.tabcn.cn/download/gd_all.7z
联系客服