设为首页 收藏本站
查看: 1707|回复: 0

[经验分享] 【引用】Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(2)

[复制链接]
累计签到:10 天
连续签到:1 天
发表于 2015-11-17 13:34:05 | 显示全部楼层 |阅读模式
  移植环境([color=\"#ff0000\"]红色粗字体字[color=\"#000000\"]为修改后内容,[color=\"#0000ff\"]蓝色粗体字为特别注意内容)
  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库,是[color=\"#000000\"]php处理[color=\"#000000\"]图形的扩展库,GD库提供了一系列用来处理图片的[color=\"#000000\"]API,使用GD库可以处理图片,或者生成图片。 在网站上GD库通常用来生成缩略图,或者用来对图片加水印,或者用来生成汉字验证码,或者对网站数据生成报表等。在PHP处理图像,可使用GD库,而GD库开始时是支持[color=\"#000000\"]GIF的,但由于GIF使用了有版权争议的LZW算法,会引起法律问题,于是从GD-1.6开始,GD库不再支持GIF,改为支持更好的,无版权争议的[color=\"#000000\"]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
  [iyunv@localhost linux-test]# tar -zxf zlib-1.2.5.tar.gz
  [iyunv@localhost zlib-1.2.5]# CC=arm-linux-gcc ./configure --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi [color=\"#0000ff\"]//此处要指定和编译器可执行程序在同级别的目录,否则将来用此库时会报错。
[color=\"#000000\"][iyunv@localhost zlib-1.2.5]# make
[iyunv@localhost zlib-1.2.5]# make install
  [color=\"#000000\"]【2】安装libtool
  [iyunv@localhost linux-test]# tar -zxvf libtool-2.4.tar.gz
  [iyunv@localhost libtool-2.4]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi
[iyunv@localhost libtool-2.4]# make
  [iyunv@localhost libtool-2.4]# make install
  【3】安装freetype
  [iyunv@localhost linux-test]# tar -jxvf freetype-2.4.5.tar.bz2
[iyunv@localhost 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
[iyunv@localhost freetype-2.4.5]# make
[iyunv@localhost freetype-2.4.5]# make install
  
【4】安装jpegsrc
  [iyunv@localhost linux-test]# tar -zxvf jpegsrc.v8c.tar.gz
[iyunv@localhost linux-test]# cd jpeg-8c
[iyunv@localhost jpeg-8c]# CC=arm-linux-gcc ./configure --host=arm-linux --enable-shared --prefix=/usr/local/arm/4.4.3/arm-none-linux-gnueabi
[iyunv@localhost jpeg-8c]# make
[iyunv@localhost jpeg-8c]# make install
  【5】安装libpng
  [iyunv@localhost linux-test]# tar -zxvf libpng-1.5.2.tar.gz
[iyunv@localhost linux-test]# cd libpng-1.5.2
[iyunv@localhost 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
[iyunv@localhost libpng-1.5.2]# make
[iyunv@localhost libpng-1.5.2]# make install
  【6】安装libiconv
  [iyunv@localhost linux-test]# cd libiconv-1.13.1
[iyunv@localhost 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
[iyunv@localhost libiconv-1.13.1]# make
[iyunv@localhost libiconv-1.13.1]# make install
  【7】安装libxml2
  [iyunv@localhost linux-test]# tar -zxvf libxml2-sources-2.7.8.tar.gz
[iyunv@localhost linux-test]# cd libxml2-2.7.8
[iyunv@localhost 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
  [iyunv@localhost libxml2-2.7.8]# make
[iyunv@localhost libxml2-2.7.8]# make install
  【8】安装gd
  [iyunv@localhost linux-test]# tar -zxvf gd-2.0.35.tar.gz
[iyunv@localhost linux-test]# cd gd-2.0.35
[iyunv@localhost gd-2.0.35]# export CC=arm-linux-gcc
[iyunv@localhost gd-2.0.35]# export CXX=arm-linux-g++
[iyunv@localhost gd-2.0.35]# export DIR=/usr/local/arm/4.4.3/arm-none-linux-gnueabi
[iyunv@localhost 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
[iyunv@localhost gd-2.0.35]# make
[iyunv@localhost gd-2.0.35]# make install
  【9】安装libmcrypt
  [iyunv@localhost linux-test]# tar -zxvf libmcrypt-2.5.8.tar.gz
[iyunv@localhost linux-test]# cd libmcrypt-2.5.8
[iyunv@localhost 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
[iyunv@localhost libmcrypt-2.5.8]# make
... ...
  ../lib/.libs/libmcrypt.so: [color=\"#0000ff\"]undefined reference to `rpl_malloc\'
../lib/.libs/libmcrypt.so: [color=\"#0000ff\"]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:
  [iyunv@localhost libmcrypt-2.5.8]# echo \"ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes\" >arm-linux.cache
[iyunv@localhost 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
[iyunv@localhost libmcrypt-2.5.8]# make
[iyunv@localhost libmcrypt-2.5.8]# make install

  【10】安装php5
  (1) 配置,有关php的选项配置请参考其帮助(即./configure --help)和PHP的编译配置详细选项
  [iyunv@localhost linux-test]# cd php-5.2.11
[iyunv@localhost php-5.2.11]# CC=arm-linux-gcc CXX=arm-linux-g++ DIR=/usr/local/arm/4.4.3/arm-none-linux-gnueabi [color=\"#0000ff\"]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[color=\"#0000ff\"] --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[color=\"#0000ff\"][color=\"#0000ff\"]--without-pear [color=\"#0000ff\"]--prefix=/nfsboot/rootfs/usr/local [color=\"#0000ff\"]--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()会产生如下错误:
  [color=\"#0000ff\"]file is encrypted or is not a database
因为php要使用pdo链接sqlite3,所以上面的相关选项需要配置成[color=\"#0000ff\"] --with-sqlite=shared  --enable-pdo=shared --with-pdo-sqlite=shared [color=\"#000000\"],配置参考http://cn.php.net/manual/en/ref.pdo-sqlite.php
  而且还要在php.ini的文件中作如下设置(在php.ini的542行附近):
  ; Directory in which the loadable extensions (modules) reside.
[color=\"#ff0000\"]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: [color=\"#0000ff\"]error: Problem with libjpeg.(a|so). Please check config.log for more information.
安装时可参考openssl的安装与使用和Linux下OpenSSL安装详解+图解。
  <4>加入php对动态扩展库的支持
  在默认情况下,phpinfo显示:
  standard
[color=\"#0000ff\"]Dynamic Library support not available
  这样无法加入一些自定义的动态库的链接,在配置时加入LDFLAGS+=-ldl ,这里是为了链接dlopen库,使
  Dynamic Library Support => enabled
  然后保存退出。
  (3)编译
[iyunv@localhost php-5.2.11]# make
  ... ...
  /usr/local/include/gnu/stus.h:7:27: error: [color=\"#0000ff\"]gnu/sts-32.h: No s h file or directory
make: *** [ext/date/php_date.lo] 错误 1
[iyunv@localhost php-5.2.11]#
  按照错误提示,进入到/usr/local/include/gnu目录下,打开stus.h,发现如下内容:
  #include <bits/wordsize.h>
  [color=\"#0000ff\"]#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,打开发现:
  [color=\"#0000ff\"]#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
  [iyunv@localhost php-5.2.11]# cp -a /nfsboot/rootfs/usr/local/lib/libsqlite3.so* /usr/local/arm/4.4.3/arm-none-linux-gnueabi/lib
[iyunv@localhost php-5.2.11]#  cp -a /nfsboot/rootfs/usr/local/include/sqlite3.h /usr/local/arm/4.4.3/arm-none-linux-gnueabi/include
[iyunv@localhost php-5.2.11]#  cp -a /nfsboot/rootfs/usr/local/include/sqlite3ext.h /usr/local/arm/4.4.3/arm-none-linux-gnueabi/include
[iyunv@localhost php-5.2.11]#
  OK,问题解决。
  ... ...
  Build complete.
Don\'t forget to run \'make test\'.
  (4)安装
  [iyunv@localhost 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/
[iyunv@localhost php-5.2.11]#

拷贝到 php.ini-recommended 到 /usr/local目录下并命名为php.ini
[iyunv@localhost php-5.2.11]# cp php.ini-recommended /nfsboot/rootfs/usr/local/php.ini
[iyunv@localhost php-5.2.11]#
  【10】重新编译安装thttpd
  因为在安装php时通过指定--with-thttpd=../thttpd-2.25b选项在thttpd-2.25源码目录中产生了关联文件,如下
[iyunv@localhost 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 [color=\"#0000ff\"]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 [color=\"#0000ff\"]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 [color=\"#0000ff\"]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清除之前产生的中间文件
  [iyunv@localhost thttpd-2.25b]# make clean
  (2)对php和thttpd之间的关联相关文件补丁
  安装php时通过指定--with-thttpd=../thttpd-2.25b选项在thttpd-2.25源码目录中产生了关联文件没有补丁,现补丁如下
[iyunv@localhost 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
[iyunv@localhost thttpd-2.25b]#
  (3)进行配置
  [iyunv@localhost 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.
  [color=\"#ff0000\"]CC =  arm-linux-gcc
CCOPT =  -O2
  打开cgi-src/Makefile,定位到34行,修改如下:
  CGIBINDIR = $(WEBDIR)/cgi-bin
MANDIR = ${prefix}/man
  [color=\"#ff0000\"]CC =  arm-linux-gcc
CCOPT =  -O2
  打开extras/Makefile,定位到35行,修改如下:
  MANDIR = ${prefix}/man
  [color=\"#ff0000\"]CC =  arm-linux-gcc
CCOPT =  -O2

  (5)编译并安装
  [iyunv@localhost thttpd-2.25b]# make
[iyunv@localhost thttpd-2.25b]# make install
  未完,接下篇。

  

             版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-140354-1-1.html 上篇帖子: Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(1) 下篇帖子: 【引用】Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(3)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表