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

[经验分享] apache+sqlite+php for Arm Linux(转)

[复制链接]

尚未签到

发表于 2015-3-8 14:49:50 | 显示全部楼层 |阅读模式
  经过几天的努力终于在arm-linux平台上搭建了apache+sqlite+php平台.
  apche与sqlite网上有不少资料,而php for arm-linux很少.为了在arm平台上安装php发了不少时间.所以将搭建过程发表在此,希望对大家有所帮助.
  Sqlite for Arm Linux安装
  1、 下载sqlite3.3.8:请到http://www.sqlite.org/download.html,将下载的代码包解开,将生成sqlite3.3.8目录
  2、 修改configure文件,将下面语句注释掉
  #if test "$cross_compiling" = "yes"; then
  # { { echo "$as_me:$LINENO:: error: unable to find a compiler for building build tools" >&5#echo "$as_me: error: unable to find a compiler for building build tools" >&2;}
  # { (exit 1); exit 1; }; }
  #fi
  . . .
  #else
  # test "$cross_compiling" = yes &&
  # { { echo "$as_me:$LINENO:: error: cannot check for file existence when cross compiling" >&5
  #echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
  # { (exit 1); exit 1; }; }
  . . .
  #else
  # test "$cross_compiling" = yes &&
  # { { echo "$as_me:$LINENO:: error: cannot check for file existence when cross compiling" >&5
  #echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
  # { (exit 1); exit 1; }; }
  3、配置
  ./configure –prefix=/data0/sqlite --disable-tcl --host=arm-linux
  4、 修改Makefile文件
  将BCC = arm-linux-gcc -g -O2改成BCC = gcc -g -O2
  5、 修改Makefile文件,将sqlite3程序以静态键接库方式编译
  先需增加libsqlite3.a的编译
  再将sqlite3$(TEXE): $(TOP)/src/shell.c .libs/libsqlite3.la sqlite3.h
  改成lite3$(TEXE): $(TOP)/src/shell.c .libs/libsqlite3.a sqlite3.h
  将 -o $@ $(TOP)/src/shell.c .libs/libsqlite3.la \
  改成 -o $@ $(TOP)/src/shell.c .libs/libsqlite3.a \
  6、 Make
  7、 #arm-linux-strip sqlite3
  8、 将sqlite3上传至终端
  9、 Sqlite3程序测试
  sqlite3 test
  ,if you see the following messages:
  SQLite version 3.3.8
  Enter ".help" for instructions
  sqlite>
  input some commands to do something,
  sqlite> create table tbl(one varchar(10),two smallint);
  sqlite> insert into tbl values('hello',10);
  sqlite> insert into tbl values('goodbye',20);
  sqlite> .quit
  10、 测试C程序
  make a 'test.c' file in 'build' directory, content as showed:   
#include     
#include "sqlite3.h" /* orignal is  */   
static int callback(void *NotUsed, int argc, char **argv, char **azColName){   
int i;   
for(i=0; i&2; exit 1; }
  #else
  4 ./configure --prefix=/data0/php --with-apxs=/data0/apache/bin/apxs --enable-pdo=shared --with-sqlite=shared  --with-pdo-sqlite=shared --with-zlib --host=arm-linux --enable-track-vars --with-xml
  5. 执行./configure会报一些错误,根据错误提示,修改configure文件注释掉错误处理,直到成功
  6.修改Makefile文件,将其中
  EXTRA_LIBS = -lcrypt -l -lcrypt -lz -lm -lcrypt –lcrypt
  替换为
  EXTRA_LIBS = -lcrypt -lcrypt -lz -lresolv -lm -ldl -lnsl -lcrypt –lcrypt
  如果不替换会在最后链接时,报can not find –l -lcrypt错误
  7.make
  8.make install时会报php程序无法执行,将交叉编译好的php备份成php_arm,再将本地编译好的php替换掉交叉编译的php. 继续make install
  9.执行完make install后,会在/data0目录下生成php目录,将php-4.4.8/sapi/cli/php_arm拷贝至/data0/php/bin目录,再将php目录打包,并传至终端的/data0目录下再解压
  10.将php-4.4.8/.libs目录下的libphp4.so文件传至终端/data0/apache/libexec目录下
  11.修改/data0/apache/conf目录下的httd.conf文件如下几个地方
  在# LoadModule foo_module libexec/mod_foo.so下面增加如下语句
  LoadModule php4_module        libexec/libphp4.so
  
  DirectoryIndex index.html index.php
  
  #
  #AddType application/x-gzip .gz .tgz
  AddType application/x-httpd-php .php
  12.在/data0/apache/htdoc目录下增加index.php文件,其内容如下:
  13.如果http://ip/index.php,能看到php信息,则说明php安装成功
  PHP Version 4.4.8
    System   
Linux localhost 2.4.18-rmk7-pxa1 #2 四 12月 27 12:28:52 CST 2007 armv4l
  Build Date   
Feb 3 2008 11:58:44
  Configure Command   
'./configure' '--prefix=/data0/php' '--with-apxs=/data0/apache/bin/apxs' '--enable-pdo=shared' '--with-sqlite=shared' '--with-pdo-sqlite=shared' '--with-zlib' '--host=arm-linux' '--enable-track-vars' '--with-xml'
  Server API   
Apache
  Virtual Directory Support   
disabled
  Configuration File (php.ini) Path   
/data0/php/lib
  PHP API   
20020918
  PHP Extension   
20020429
  Zend Extension   
20050606
  Debug Build   
no
  Zend Memory Manager   
enabled
  Thread Safety   
disabled
  Registered PHP Streams   
php, http, ftp, compress.zlib
                                                                                php与sqlite3结合
    先从php网站上下载php-sqlite3压缩包
  1.把压缩包,解压缩到一个目录.   
2.进入该目录,运行/data0/php/bin/phpize   
3../configure --with-php-config=/data0/php/bin/php-config --with-sqlite3=你的sqlite3安装目录   
4.make   
5.make install   
6.把生成的sqlite3.so放到php扩展目录下.   
7.在php.ini加载一下sqlite3.so模块

运维网声明 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-44515-1-1.html 上篇帖子: linux内核数据库sqlite3的移植和简单操作 下篇帖子: linux下安装sqlite3
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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