==================================
下面才開(kāi)始安裝 GD庫,安裝gd庫成功與否,與下面的安裝順序有一定的關(guān)系
我們就一步步來(lái)演示安裝, 下面所有用到的文件,可以到
http://www.tabcn.cn/download/gd_all.7z下載
把全部的文件 都放進(jìn) webserv 目錄下
1:安裝zlib2
同樣, 在Linux下使用 wget 來(lái)下載文件
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}
上面這個(gè)命令具體是實(shí)現這樣的:
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'
可以說(shuō)是一個(gè)小小的bug吧,要我們手動(dòng)建立這些目錄,否則configure時(shí)候會(huì )說(shuō)找不到目錄。
./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 操作 時(shí)間相對也會(huì )比較長(cháng),呵呵
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
可以看到, 參數比較長(cháng), 我建議用記事本的朋友不要選擇 自動(dòng)換行。
看我操作, 自動(dòng)換行 復制過(guò)去執行有時(shí)會(huì )出錯。去掉 自動(dòng)換行
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
這里顯示一個(gè)錯誤信息:
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.
但是我們在上面其實(shí)已經(jīng)安裝上 libxml2 了的,這里只是一個(gè) 環(huán)境變量沒(méi)有設置好而已。
解決辦法: 確定 /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
好了吧,沒(méi)有出現那個(gè)錯誤了。
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庫全部過(guò)程演示完了,
這樣還是不是很好的感覺(jué)出來(lái),等我們下一節視頻-
就是把 php5.2.6也裝上了,那么才知道 php 支持了 gif jpg png wbmp xml ttf字體
下載相關(guān)軟件包 http://www.tabcn.cn/download/gd_all.7z
聯(lián)系客服