在 Linux 下配置 PHP 支援 GD

文章位置: 主頁 > 文章資料庫 > PHP 教學 > PHP 安裝 > 在 Linux 下配置 PHP 支援 GD
瀏覽次數: 24762
更新時間: 2005/06/13 21:35

本站的另一篇文章介紹了在 Linux 下配置 PHP + MySQL 的執行環境,而照著該篇文章安裝的 PHP 是未能支援 GD 的。而本文就是介紹在 Linux 下安裝 GD,並配置 PHP 支援 GD。

GD 安裝

第一部需要做的是先要安裝 GD 到系統內,而安裝 GD 前需要安裝 jpeg-6b, libpng, zlib。以下是下載網址:

GD 2.0.33
jpeg-6b
libpng 1.2.8
zlib 1.2.2

下載完成後鍵入以下指令進行安裝。

安裝 zlib
01 tar zxvf zlib-1.2.2.tar.gz
02 cd zlib-1.2.2
03 ./configure
04 make
05 make install


安裝 libpng
01 tar zxvf libpng-1.2.8-config.tar.gz
02 cd libpng-1.2.8-config
03 ./configure
04 make
05 make install


安裝 jpeg-6b
01 tar zxvf jpegsrc.v6b.tar.gz
02 cd jpeg-6b
03 ./configure
04 make
05 make install


安裝 GD
01 tar zxvf gd-2.0.33.tar.gz
02 cd gd-2.0.33
03 ./configure
04 make
05 make install


因為以上各套件均使用預設值安裝,所以安裝時所遇到的問題會較少,下一步需要配置 PHP 。

PHP 配置

現在需要重新編譯 PHP,並選擇支援 GD,如果系統內已刪除了 PHP 的原始碼,可以到 php.net 下載,然後輸入以下指令:

01 tar zxvf php-4.3.11.tar.gz
02 cd php-4.3.11
03 ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --prefix=/usr/local/php --with-gd --with-zlib-dir=/usr/local
04 make
05 make install

以上在 ./configure 裡的選項只可以參考,在編譯時必須根據自己的環境配置而修改,而 --with-gd 及 --with-zlib-dir=/usr/local 就是設定成支援 GD。


====================================================
歡迎轉載,但轉載時請保留此宣告,不得作為商業用途
作者: Sam Tang <admin{at}phpini{dot}com>
來源網站: http://www.phpdc.com/


用戶評論 按這裡發表新評論 
水彩筆 user at yourdomain dat com
12 November 2005 09:59
非常感謝~~來去試看看
 
學習中的菜鳥 user at yourdomain dat com
26 December 2005 14:20
[root@Linux jpeg-6b]# ./configure --prefix=/usr/local/modules/jpeg-6
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking how to run the C preprocessor... gcc -E
checking for function prototypes... yes
checking for stddef.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for size_t... yes
checking for type unsigned char... yes
checking for type unsigned short... yes
checking for type void... yes
checking for working const... yes
checking for inline... __inline__
checking for broken incomplete types... ok
checking for short external names... ok
checking to see if char is signed... yes
checking to see if right shift is signed... yes
checking to see if fopen accepts b spec... yes
checking for a BSD compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking libjpeg version number... 62
creating ./config.status
creating Makefile
creating jconfig.h
jconfig.h is unchanged

請問可能導致的原因及處理的分法...感恩
 
sswxy sswxychen at gmail dat com
27 December 2005 21:49
--with-apxs2=/usr/local/apache/bin/apxs
執行這一段的時候 出現 沒有這個資料夾
我的系統rh9.0 Apache版本2.0.40
去除上面那一段後 就可以順利安裝
不知道為什麼??
Q1:
安裝完成後 要怎麼變成新版本的php呢 原先是裝4.2.2
 
 
 發表評論
姓名:
Email:
內容: