- 论坛徽章:
- 1
|
本文就是介紹在 Linux 下安裝 GD,並配置 PHP 支援 GD
GD 安裝
第一部需要做的是先要安裝 GD 到系統內,而安裝 GD 前需要安裝 jpeg-6b, libpng, zlib, freetype。以下是下載網址:
GD 2.0.33
jpeg-6b
libpng 1.2.8
zlib 1.2.3
freetype-2.1.10.tar.gz
建立安裝套件目錄
mkdir /usr/local/modules
下載完成後鍵入以下指令進行安裝。
安裝 zlib
#不要用–prefix指訂安裝目錄會影響GD
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install
安裝 freetype
tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure –prefix=/usr/local/modules/freetype
make
make install
安裝 libpng
#不要用–prefix指訂安裝目錄會影響GD
tar zxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure
make
make install
安裝 jpeg-6b
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure –prefix=/usr/local/modules/jpeg6 –enable-shared –enable-static
make
make install
這步有可能出錯,主要原因是不能自動建文件夾,到時出了問題,少那個文件夾,就自己用madir命令建那個文件夾就能解決
安裝 GD
tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure –prefix=/usr/local/modules/gd
–with-jpeg=/usr/local/modules/jpeg6 –with-png –with-zlib
–with-freetype=/usr/local/modules/freetype
make
make install
下一步需要配置 PHP 。
注:安裝imap的方法先下載imap2006e.tar.gz.Z
在php編譯時加上-with-imap=下載後解開的文件夾
這個也有點小問題,在maik時會出utf8_mime2text的錯,解決方法是先用find 查一下php源文件下的ext/php_imap.c 這個文件,然後用vi編緝他,查找utf8_mime2text,然後刪除那二行.
然後在重新編譯php就可以解決
PHP 配置
現在需要重新編譯 PHP,並選擇支援 GD,如果系統內已刪除了 PHP 的原始碼,可以到 php.net 下載,然後輸入以下指令:
請在configure 後加上如下
-with-gd=/usr/local/modules/gd
–with-jpeg-dir=/usr/local/modules/jpeg6 –with-zlib –with-png
–with-freetype-dir=/usr/local/modules/freetype
其餘請自行加入
tar zxvf php-4.4.1.tar.gz
cd php-4.4.1
./configure 如上指令
make
make install
以上在 ./configure 裡的選項只可以參考,在編譯時必須根據自己的環境配置而修改,而 –with-gd 及 –with-zlib-dir=/usr/local 就是設定成支援 GD。
注:我个人的php的编译的设置.
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local --with-iconv --with-mbstring --enable-mbstring --enable-track-vars --enable-force-cgi-redirect --enable-ftp -with-gd=/usr/local/modules/gd/ -with-jpeg-dir=/usr/local/modules/jpeg6/ -with-zlib -with-png -with-freetype-dir=/usr/local/modules/freetype/ -with-iconv -with-imap=/usr/src/imap-2006e --with-imap-ssl --enable-versioning
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/12859/showart_244364.html |
|