天天看點

Linux應用程式開發(一)---移植thttpd+Sqlite3+PHP5到arm linux(2)

Linux應用程式開發(一)---移植thttpd+Sqlite3+PHP5到arm linux(2)  

移植環境(紅色粗字型字為修改後内容,藍色粗體字為特别注意内容)

1,主機環境:VMare下CentOS 5.5 ,1G記憶體。

2,內建開發環境:Elipse IDE

3,編譯編譯環境:arm-linux-gcc v4.4.3,arm-none-linux-gnueabi-gcc v4.5.1。

4,開發闆:mini2440,2M nor flash,128M nand flash。

5,u-boot版本:u-boot-2009.08

6,linux 版本:linux-2.6.32.2

7,參考文章:

移植thttpd Web伺服器到ARM-Linux系統

深入研究嵌入式web伺服器的視訊監控應用

輕量型thttpd+php5

Cross compiling thttpd-2.21b + php-5.2.1

接上篇

3,安裝PHP5

參考文章PHP5 交叉編譯

安裝之前應先下載下傳下列源碼:

php-5.2.11-thttpd-2.25b.tar.bz2源碼:http://download2.3tera.net/oss/files/osm/thttpd-2.25b/

在安裝php5之前應先安裝下列庫:

(1) zlib-1.2.5.tar.gz : http://www.dnaphp.com/downloads/server/linux/30-zlib-1-2-5-tar

zlib是提供資料壓縮用的函式庫,由Jean-loup Gailly與Mark Adler所開發,初版0.9版在1995年5月1日發表。zlib使用DEFLATE算法,最初是為libpng函式庫所寫的,後來普遍為許多軟體所使用。此函式庫為自由軟體,使用zlib授權。截至2007年3月,zlib是包含在Coverity的美國國土安全部贊助者選擇繼續審查的開源項目。

(2) libtool-2.4.tar.gz :  http://www.gnu.org/software/libtool/

在不同的系統中建立動态連結庫的方法有很大的差别,這主要是因為每個系統對動态連結庫的看法和實作并不相同,以及編譯器對動态連結庫支援的選項也不太一樣。對于開發人員,如果嘗試将使用動态庫的軟體在這些系統之間移植,需要參考枯澀難懂的系統手冊,以及修改相應的 Makefile,這一工作是乏味的,并且具有一定的難度。

使用 GNU Libtool 可以容易的在不同的系統中建立動态連結庫。它通過一個稱為 Libtool 庫的抽象,隐藏了不同系統之間的差異,給開發人員提供了一緻的的接口。對于大部分情況,開發人員甚至不用去檢視相應的系統手冊,隻需要掌握 GNU Libtool 的用法就可以了。并且,使用 Libtool 的 Makefile 也隻需要編寫一次就可以在多個系統上使用。

Libtool 庫可以是一個靜态連結庫,可以是一個動态連結庫,也可以同時包含兩者。在這篇文檔中,我們圍繞 Libtool 庫的建立和使用,隻是在适當的說明 Libtool 庫和系統動态或者靜态連結庫之間的映射關系。雖然 Libtool 隐藏了在不同平台建立連結庫的複雜性,但其最終還是需要底層系統對連結庫的支援,它不能超越系統的限制,例如,Libtool 并不能在不支援動态連結庫的系統中建立出動态連結庫。源自http://www.ibm.com/developerworks/cn/aix/library/1007_wuxh_libtool/。

(3) freetype-2.4.5.tar.bz2 : http://download.savannah.gnu.org/releases/freetype/

FreeType庫是一個完全免費(開源)的、高品質的且可移植的字型引擎,它提供統一的接口來通路多種字型格式檔案,包括TrType, OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF等。支援單色位圖、反走樣位圖的渲染。FreeType庫是高度子產品化的程式庫,雖然它是使用ANSI C開發,但是采用面向對象的思想。是以,FreeType的使用者可以靈活地對它進行裁剪。源自http://baike.baidu.com/view/4579855.htm。

(4) libiconv-1.13.1.tar.gz : http://ftp.gnu.org/p /gnu/libiconv/

由于曆史原因,國際化的文字常常由于語言或者國家的原因使用不同的編碼。随着網際網路時代的到來,通過網際網路進行文字交流也逐漸增多:浏覽外國的網站,這個時候字元編碼的轉換變得尤為重要。這帶來了一個問題,就是許多字元在某一種編碼方式中沒有。為了解決這種混亂,Unicode的編碼方式被建立。Unicode是一種超級編碼包含了所有這些編碼的字元集,是以一些新的文本格式像XML的預設編碼方式就是Unicode.。

但是很多老式的計算機還在使用當地的傳統的字元編碼方式。而一些程式,例如郵件程式和浏覽器必須能在這些不同的使用者編碼之間作轉換。其他的一些程式則内置支援Unicode,以順利支援國際化的處理,但是仍然有在Unicode和其他的傳統編碼之間轉換的需求。GNU的libiconv就是為這兩種應用設計的編碼轉換庫。源自http://baike.baidu.com/view/3358257.htm

(5) jpegsrc.v8c.tar.gz : http://www.ijg.org/

JPEG是Joint Photographic Experts Group(聯合圖像專家組)的縮寫,檔案後辍名為".jpg"或".jpeg",是最常用的圖像檔案格式,由一個軟體開發聯合會組織制定,是一種有損壓縮格式,能夠将圖像壓縮在很小的儲存空間。源自http://baike.baidu.com/view/1635264.htm

(6) libpng-1.5.2.tar.gz : ftp://ftp.simplesystems.org/p /libpng/png/src/

libpng is the official PNG reference library. It supports almost all PNG features, is extensible, and has been extensively tested for over 15 years.源自http://www.libpng.org/p /png/libpng.html.

(7) libxml2-sources-2.7.8.tar.gz : ftp://xmlsoft.org/libxml2/

Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform)。源自http://xmlsoft.org/

(8) gd-2.0.35.tar.gz : http://www.dnaphp.com/downloads/server/linux/18-gd-2-0-35-tar

GD庫,是php處理圖形的擴充庫,GD庫提供了一系列用來處理圖檔的API,使用GD庫可以處理圖檔,或者生成圖檔。 在網站上GD庫通常用來生成縮略圖,或者用來對圖檔加水印,或者用來生成漢字驗證碼,或者對網站資料生成報表等。在PHP處理圖像,可使用GD庫,而GD庫開始時是支援GIF的,但由于GIF使用了有版權争議的LZW算法,會引起法律問題,于是從GD-1.6開始,GD庫不再支援GIF,改為支援更好的,無版權争議的PNG。源自http://baike.baidu.com/view/1752478.htm。

(9)PEAR-1.9.4.tar.tgz : http://pear.php.net/package/PEAR/download

PAER 擴充庫,PEAR是PHP擴充與應用庫(the PHP Extension and Application Repository)的縮寫。它是一個PHP擴充及應用的一個代碼倉庫,簡單地說,PEAR之于PHP就像是CPAN(Comprehensive Perl Archive Network)之于Perl。

PEAR的基本目标是發展成為PHP擴充和庫代碼的知識庫,而這個項目最有雄心的目标則是試圖定義一種标準,這種标準将幫助開發者編寫可移植、可重用的代碼。源自http://baike.baidu.com/view/20453.htm 。

(10)libmcrypt-2.5.8.tar.gz : http://cdnetworks-kr-2.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

mcrypt編碼函數庫,通過在php配置時加入--with-mcrypt使用此編碼功能。

(11) openssl-1.0.0d.tar.gz : ftp://ftp.openssl.org/source/

SSL是Secure Socket Layer(安全套接層協定)的縮寫,可以在Internet上提供秘密性傳輸。OpenSSL整個軟體包大概可以分成三個主要的功能部分:密碼算法庫、SSL協定庫以及應用程式。OpenSSL的目錄結構自然也是圍繞這三個功能部分進行規劃的。源自http://baike.baidu.com/view/300712.htm。

【1】安裝zlib

 [[email protected] linux-test]# tar -zxf zlib-1.2.5.tar.gz

[[email protected] zlib-1.2.5]# CC=arm-linux-gcc ./configure --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi //此處要指定和編譯器可執行程式在同級别的目錄,否則将來用此庫時會報錯。

[[email protected] zlib-1.2.5]# make

[[email protected] zlib-1.2.5]# make install

【2】安裝libtool

[[email protected] linux-test]# tar -zxvf libtool-2.4.tar.gz

[[email protected] libtool-2.4]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] libtool-2.4]# make

[[email protected] libtool-2.4]# make install

【3】安裝freetype

[[email protected] linux-test]# tar -jxvf freetype-2.4.5.tar.bz2

[[email protected] freetype-2.4.5]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] freetype-2.4.5]# make

[[email protected] freetype-2.4.5]# make install

【4】安裝jpegsrc

[[email protected] linux-test]# tar -zxvf jpegsrc.v8c.tar.gz

[[email protected] linux-test]# cd jpeg-8c

[[email protected] jpeg-8c]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] jpeg-8c]# make

[[email protected] jpeg-8c]# make install

【5】安裝libpng

[[email protected] linux-test]# tar -zxvf libpng-1.5.2.tar.gz

[[email protected] linux-test]# cd libpng-1.5.2

[[email protected] libpng-1.5.2]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueai

[[email protected] libpng-1.5.2]# make

[[email protected] libpng-1.5.2]# make install

【6】安裝libiconv

[[email protected] linux-test]# cd libiconv-1.13.1

[[email protected] libiconv-1.13.1]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] libiconv-1.13.1]# make

[[email protected] libiconv-1.13.1]# make install

【7】安裝libxml2

[ro[email protected] linux-test]# tar -zxvf libxml2-sources-2.7.8.tar.gz

[[email protected] linux-test]# cd libxml2-2.7.8

[[email protected] libxml2-2.7.8]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --with-zlib --with-iconv --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] libxml2-2.7.8]# make

[[email protected] libxml2-2.7.8]# make install

【8】安裝gd

[[email protected] linux-test]# tar -zxvf gd-2.0.35.tar.gz

[[email protected] linux-test]# cd gd-2.0.35

[[email protected] gd-2.0.35]# export CC=arm-linux-gcc

[[email protected] gd-2.0.35]# export CXX=arm-linux-g++

[[email protected] gd-2.0.35]# export DIR=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] gd-2.0.35]# ./configure --host=arm-linux --enable-shared --with-freetype --with-jpeg= --with-png --with-libiconv-prefix --prefix=/usr/local/arm/4.4.3/arm-none-linux-gneabi

[[email protected] gd-2.0.35]# make

[[email protected] gd-2.0.35]# make install

【9】安裝libmcrypt

[[email protected] linux-test]# tar -zxvf libmcrypt-2.5.8.tar.gz

[[email protected] linux-test]# cd libmcrypt-2.5.8

[[email protected] libmcrypt-2.5.8]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi

[[email protected] libmcrypt-2.5.8]# make

... ...

../lib/.libs/libmcrypt.so: undefined reference to `rpl_malloc'

../lib/.libs/libmcrypt.so: undefined reference to `rpl_realloc'

collect2: ld returned 1 exit status

make[2]: *** [ciphertest] 錯誤 1

make[2]: Leaving directory `/root/linux-test/libmcrypt-2.5.8/src'

make[1]: *** [all-recursive] 錯誤 1

make[1]: Leaving directory `/root/linux-test/libmcrypt-2.5.8'

make: *** [all] 錯誤 2

在目前目錄分别查找了rpl_malloc和rpl_malloc,發現configure裡分别有#define malloc rpl_malloc和#define realloc rpl_realloc。分析configure 腳本相關的代碼,原來是ac_cv_func_malloc_0_nonnull和ac_cv_func_realloc_0_nonnull引起的,OK,我們不讓它檢查了,産生一個cache檔案arm-linux.cache,欺騙configure:

[[email protected] libmcrypt-2.5.8]# echo "ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes" >arm-linux.cache

[[email protected] libmcrypt-2.5.8]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi --cache-file=arm-linux.cache

[[email protected] libmcrypt-2.5.8]# make

[[email protected] libmcrypt-2.5.8]# make install

【10】安裝php5

(1) 配置,有關php的選項配置請參考其幫助(即./configure --help)和PHP的編譯配置詳細選項

[[email protected] linux-test]# cd php-5.2.11

[[email protected] php-5.2.11]# CC=arm-linux-gcc CXX=arm-linux-g++ DIR=/usr/local/arm/4.4.3/arm-none-linux-gnueabi LDFLAGS+=-ldl ./configure --host=arm-linux --enable-shared --with-zlib-dir --with-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --enable-gd-native-ttf --enable-soap --enable-libxml --with-libxml-dir  --with-iconv --with-sqlite=shared  --enable-pdo=shared --with-pdo-sqlite=shared --with-thttpd=../thttpd-2.25b  --enable-mbstring --enable-calendar --enable-sockets --enable-ftp --enable-sqlite-utf8  --enable-fastcgi  --enable-zend-multibyte  --enable-discard-path  --without-pear --prefix=/nfsboot/rootfs/usr/local --with-config-file-path=/usr/local --with-config-file-scan-dir=/usr/local

配置說明:

<1>這裡要禁用掉pear擴充,是為了避免安裝時出現如下錯:

make[1]: *** [install-pear-installer] 錯誤 126

make: *** [install-pear] 錯誤 2

<2>官方解讀:sqlite_open()隻支援sqlite2版本,暫不支援sqlite3版本;若連接配接sqlite3必須用sqlite_pdo去連接配接,若直接使用sqlite_open()會産生如下錯誤:

file is encrypted or is not a database

因為php要使用pdo連結sqlite3,是以上面的相關選項需要配置成 --with-sqlite=shared  --enable-pdo=shared --with-pdo-sqlite=shared ,配置參考http://cn.php.net/manual/en/ref.pdo-sqlite.php

而且還要在php.ini的檔案中作如下設定(在php.ini的542行附近):

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"

extension=pdo.so

extension=pdo_sqlite.so

extension=sqlite.so

<3>如果加上--with-openssl-dir ,修要安裝openssl,否則會出現類似如下錯誤(參考php官方解釋Bug #28672 error: Problem with libjpeg.(a|so) ):

checking for jpeg_read_header in -ljpeg... no

configure: error: Problem with libjpeg.(a|so). Please check config.log for more information.

安裝時可參考openssl的安裝與使用和Linux下OpenSSL安裝詳解+圖解。

<4>加入php對動态擴充庫的支援

在預設情況下,phpinfo顯示:

standard

Dynamic Library support not available

這樣無法加入一些自定義的動态庫的連結,在配置時加入LDFLAGS+=-ldl ,這裡是為了連結dlopen庫,使

Dynamic Library Support => enabled

然後儲存退出。

(3)編譯

[[email protected] php-5.2.11]# make

... ...

/usr/local/include/gnu/stus.h:7:27: error: gnu/sts-32.h: No s h file or directory

make: *** [ext/date/php_date.lo] 錯誤 1

[[email protected] php-5.2.11]#

按照錯誤提示,進入到/usr/local/include/gnu目錄下,打開stus.h,發現如下内容:

#include <bits/wordsize.h>

#if __WORDSIZE == 32

# include<gnu/stus-32.h>

#elif __WORDSIZE == 64

# include <gnu/stus-64.h>

#else

# error "unexpected value for __WORDSIZE macro"

#endif

在/usr/include/bits目錄下找到wordsize.h,打開發現:

#define __WORDSIZE 32

說明定義的第一個條件滿足,然後去包含 /usr/local/include/gnu/stus-32.h,而此目錄下沒有這個檔案,故而出錯。經過查找,這個檔案在 /usr/inclue/gnu目錄下,将其複制到該目錄下後,再次make

... ...

/usr/local/arm/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lsqlite3

collect2: ld returned 1 exit status

make: *** [sapi/cli/php] 錯誤 1

提示沒有找到sqlite3庫,把前面編譯好庫和相關頭檔案複制過去,再次make

[[email protected] php-5.2.11]# cp -a /nfsboot/rootfs/usr/local/lib/libsqlite3.so* /usr/local/arm/4.4.3/arm-none-linux-gnueabi/lib

[[email protected] php-5.2.11]#  cp -a /nfsboot/rootfs/usr/local/include/sqlite3.h /usr/local/arm/4.4.3/arm-none-linux-gnueabi/include

[[email protected] php-5.2.11]#  cp -a /nfsboot/rootfs/usr/local/include/sqlite3ext.h /usr/local/arm/4.4.3/arm-none-linux-gnueabi/include

[[email protected] php-5.2.11]#

OK,問題解決。

... ...

Build complete.

Don't forget to run 'make test'.

(4)安裝

[[email protected] php-5.2.11]# make install

Installing PHP SAPI module:       thttpd

Installing PHP CLI binary:        /nfsboot/rootfs/usr/local/bin/

Installing PHP CLI man page:      /nfsboot/rootfs/usr/local/man/man1/

Installing shared extensions:     /nfsboot/rootfs/usr/local/lib/php/extensions/no-debug-non-zts-20060613/

Installing build environment:     /nfsboot/rootfs/usr/local/lib/php/build/

Installing header files:          /nfsboot/rootfs/usr/local/include/php/

Installing helper programs:       /nfsboot/rootfs/usr/local/bin/

  program: phpize

  program: php-config

Installing man pages:             /nfsboot/rootfs/usr/local/man/man1/

  page: phpize.1

  page: php-config.1

Installing PDO headers:          /nfsboot/rootfs/usr/local/include/php/ext/pdo/

[[email protected] php-5.2.11]#

拷貝到 php.ini-recommended 到 /usr/local目錄下并命名為php.ini

[[email protected] php-5.2.11]# cp php.ini-recommended /nfsboot/rootfs/usr/local/php.ini

[[email protected] php-5.2.11]#

【10】重新編譯安裝thttpd

因為在安裝php時通過指定--with-thttpd=../thttpd-2.25b選項在thttpd-2.25源碼目錄中産生了關聯檔案,如下

[[email protected] thttpd-2.25b]# ll

總計 868

-r-xr--r-- 1 root root   5792 2003-12-26 aclocal.m4

drwxr-xr-x 2 root root   4096 07-19 15:04 cgi-bin

drwxr-xr-x 2 root root   4096 07-20 14:15 cgi-src

-r-xr--r-- 1 root root  20370 1998-05-09 config.guess

-rwxr--r-- 1 root root  15929 07-19 18:38 config.h

-rwxr--r-- 1 root root  15942 07-19 18:33 config.h.orig

-r-xr--r-- 1 root root  19236 1998-05-09 config.sub

-rwxr--r-- 1 root root  84273 07-19 18:38 configure

-r-xr--r-- 1 root root   3540 07-19 18:38 configure.in

-r-xr--r-- 1 root root   3554 07-19 18:33 configure.in.orig

-rwxr--r-- 1 root root  84287 07-19 18:33 configure.orig

drwxr-xr-x 3 root root   4096 07-19 15:04 contrib

drwxr-xr-x 2 root root   4096 07-20 14:15 extras

-r-xr--r-- 1 root root  19762 2005-06-30 fdwatch.c

-r-xr--r-- 1 root root   3548 2005-06-30 fdwatch.h

-r-xr--r-- 1 root root    724 2002-04-03 FILES

-r-xr--r-- 1 root root    311 2005-06-30 index.html

-r-xr--r-- 1 root root   1268 2003-12-30 INSTALL

-r-xr--r-- 1 root root   5585 2001-03-30 install-sh

-r-xr--r-- 1 root root 114583 07-19 18:38 libhttpd.c

-r-xr--r-- 1 root root 115448 07-19 18:33 libhttpd.c.orig

-r-xr--r-- 1 root root   9058 07-19 18:38 libhttpd.h

-r-xr--r-- 1 root root   9144 07-19 18:33 libhttpd.h.orig

lrwxrwxrwx 1 root root     42 07-21 13:38 libphp5.a -> /root/linux-test/php-5.2.11/libs/libphp5.a

-rw-r--r-- 1 root root   5626 07-19 18:31 Makefile~

-rwxr--r-- 1 root root   4977 07-19 18:38 Makefile.in

-rwxr--r-- 1 root root   5063 07-19 18:33 Makefile.in.orig

-r-xr--r-- 1 root root   2661 2005-06-30 match.c

-r-xr--r-- 1 root root   1679 2005-06-30 match.h

-rwxr--r-- 1 root root    199 2001-12-24 mime_encodings.txt

-rwxr--r-- 1 root root   4632 2003-10-27 mime_types.txt

-r-xr--r-- 1 root root  12361 2005-06-30 mmc.c

-r-xr--r-- 1 root root   2402 2005-06-30 mmc.h

-rwxr--r-- 1 root root    668 07-21 13:38 php_makefile

-rwxr--r-- 1 root root      0 07-07 13:58 php_patched

lrwxrwxrwx 1 root root     48 07-21 13:38 php_thttpd.c -> /root/linux-test/php-5.2.11/sapi/thttpd/thttpd.c

-rwxr--r-- 1 root root  17873 07-19 18:33 php_thttpd.c.orig

lrwxrwxrwx 1 root root     52 07-21 13:38 php_thttpd.h -> /root/linux-test/php-5.2.11/sapi/thttpd/php_thttpd.h

-r-xr--r-- 1 root root   1326 2005-06-30 README

drwxr-xr-x 2 root root   4096 07-19 15:04 scripts

-r-xr--r-- 1 root root   1259 1999-08-17 strerror.c

-r-xr--r-- 1 root root   8284 2005-06-30 tdate_parse.c

-r-xr--r-- 1 root root   1575 2005-06-30 tdate_parse.h

-r-xr--r-- 1 root root  24410 2005-06-30 thttpd.8

-r-xr--r-- 1 root root  56926 07-19 18:38 thttpd.c

-r-xr--r-- 1 root root  57320 07-19 18:33 thttpd.c.orig

-r-xr--r-- 1 root root   7956 2005-06-30 timers.c

-r-xr--r-- 1 root root   3987 2005-06-30 timers.h

-rwxr--r-- 1 root root   2733 2003-10-27 TODO

-r-xr--r-- 1 root root    237 07-19 18:38 version.h

-r-xr--r-- 1 root root    240 07-19 18:33 version.h.orig

從上面資訊可以看到,thttpd-2.25b源檔案目錄下有php新增的兩個檔案php_thttpd.c和php_thttpd.h是指向php-5.2.11源目錄下的thttpd.c和php_thttpd.h的軟連接配接,是以還需要重新編譯安裝thttpd。

(1)在重新編譯安裝之前make clean清除之前産生的中間檔案

[[email protected] thttpd-2.25b]# make clean

(2)對php和thttpd之間的關聯相關檔案更新檔

安裝php時通過指定--with-thttpd=../thttpd-2.25b選項在thttpd-2.25源碼目錄中産生了關聯檔案沒有更新檔,現更新檔如下

[[email protected] thttpd-2.25b]# patch -p1 <../php-5.2.11/sapi/thttpd/thttpd-2.25b_patch

patching file Makefile.in

patching file config.h

patching file configure

patching file configure.in

patching file libhttpd.c

patching file libhttpd.h

patching file php_thttpd.c

Hunk #2 succeeded at 659 (offset 3 lines).

patching file thttpd.c

patching file version.h

[[email protected] thttpd-2.25b]#

(3)進行配置

[[email protected] thttpd-2.25b]# CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/nfsboot/rootfs/usr/local

(4)還需要象開始安裝時那樣确認作如下修改

打開thttpd-2.25b目錄下的Makefile,定位到50行附近,修改如下:

# You shouldn't need to edit anything below here.

CC =  arm-linux-gcc

CCOPT =  -O2

打開cgi-src/Makefile,定位到34行,修改如下:

CGIBINDIR = $(WEBDIR)/cgi-bin

MANDIR = ${prefix}/man

CC =  arm-linux-gcc

CCOPT =  -O2

打開extras/Makefile,定位到35行,修改如下:

MANDIR = ${prefix}/man

CC =  arm-linux-gcc

CCOPT =  -O2

(5)編譯并安裝

[[email protected] thttpd-2.25b]# make

[[email protected] thttpd-2.25b]# make install

未完,接下篇。