历史上的今天
今天是:2025年01月31日(星期五)
2020年01月31日 | apache+sqlite+php for Arm Linux
2020-01-31 来源:eefocus
经过几天的努力终于在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: #arm-linux-gcc test.c -L.libs -lsqlite3 –static #arm-linux-strip a.out 将a.out程序上传至终端,并执行 #a.out test "select * from tbl" one = hello two = 10 one = goodbye two = 20 apache服务器for ARM Linux 1. 从http://www.apache.org/ 上下载apache_1.3.39.tar.gz,然后解压缩的一个目录,然后转到apache_1.3.39目录。 2. 使用本地的gcc编译这个版本,运行: ./ configure make 完成后,不需要make install 3. 然后创建一个新的编译arm版本的目录,然后在那个目录下解压缩apache_1.3.39.tar.gz,转到该目录下的apache_1.3.39,运行: export CC="arm-linux-gcc" ./configure --prefix=/data0/apache/ --without-execstrip --enable-module=so 然后运行make 命令,这时编译会在apache_1.3.39/src/main/gen_test_char处失败,因为arm版本该程序无法在本地机器运行,你需要把前面编译的本地版本的apache_1.3.39/src/main/gen_test_char覆盖这个arm版本,然后转到arm版本的apache_1.3.39下继续make,随后编译到另一个程序apache_1.3.39/src/main/gen_uri_delims也出现相同的问题,也使用本地版本覆盖掉它,继续make,直到最后编译成功。 4. --prefix=/data0/apache /指定了安装的目录为/data0/apache/,运行make install,所有编译好的arm版本的apache程序都安装到了/data0/apache/目录下,你把这个目录压缩后,上传至终端上,然后修改conf/httpd.conf配置文件。 5.注意要修改conf/httpd.conf,增加ServerName www.willfar-ertu.com:80,否则在启动服务时会报一个警告httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName 6 .执行如下命令判断apache是否安装成功 http://IP:80 如果显示了apache说明页面,则说明安装成功.如果出现403的错误提示,请确认apache的目录权限是否为755,包括apache的上级目录. PHP for ARM Linux 1. 从http://www.php.net 上下载php-4.4.8.tar.gz,然后解压缩的一个目录,然后转到php-4.4.8目录 2. export CC=”arm-linux-gcc” 3. 修改configure文件,将其中交叉编译错误处理注释掉,例: #if test "$cross_compiling" = yes; then # { echo "configure: error 7: can not run test program while cross compiling" 1>&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 替换为 http://ip/index.php,能看到php信息,则说明php安装成功 System Build Date Configure Command Server API Virtual Directory Support Configuration File (php.ini) Path PHP API PHP Extension Zend Extension Debug Build Zend Memory Manager Thread Safety Registered PHP Streams 先从php网站上下载php-sqlite3压缩包 1.把压缩包,解压缩到一个目录.
#include
#include "sqlite3.h" /* orignal is
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i
}
printf("n");
return 0;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
if( argc!=3 ){
fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENTn", argv[0]);
exit(1);
}
rc = sqlite3_open(argv[1], &db);
if( rc ){
fprintf(stderr, "Can't open database: %sn", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %sn", zErrMsg);
sqlite3_free(zErrMsg);
}
sqlite3_close(db);
return 0;
}PHP Version 4.4.8
Linux localhost 2.4.18-rmk7-pxa1 #2 四 12月 27 12:28:52 CST 2007 armv4l
Feb 3 2008 11:58:44
'./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'
Apache
disabled
/data0/php/lib
20020918
20020429
20050606
no
enabled
disabled
php, http, ftp, compress.zlibphp与sqlite3结合
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模块
上一篇:ARM裸机篇--串口UART实验
下一篇:arm架构与体系结构
史海拾趣
|
本帖最后由 paulhyde 于 2014-9-15 03:38 编辑 比赛中常用的模块有: 运算放大器模块 滤波器模块 AGC模块 DDS信号源模块 电机驱动模块 A/D模块 D/A模块 欢迎大家把资料共享,查找资料! … 查看全部问答> |
|
各位大虾,本人使用的s3c2410的芯片,在裸机下编程时出现了一个问题,我写了一段程序用于触发CPU的异常中断,但是CPU中断时没有进入中断服务函数中,不知道各位大虾有没有碰到过这种情况,如何才能够让CPU异常中断进入我的中断服务函数中?… 查看全部问答> |
|
我要用MFC编写PC端蓝牙软件,有搜索、连接、加密和传输文件的功能,希望大虾们能给我点MFC关于蓝牙编程的资料,如果有源代码参考的话就更好了。我能给的分不多,还请大虾们能无私的帮小弟个忙。感激,感激! … 查看全部问答> |
|
scancodetovirtualkey,我看了源码是调用*puiVk = MapVirtualKey(*puiSc, MAP_SC_TO_VK); 但这个函数我没找到。有谁知道的,帮忙解答下```… 查看全部问答> |
|
根据udp的协议,编写了服务器端和客户机端的程序,想验证一下收发数据是否正确,可以将收发的程序都下载到目标机下,通过自发自收来实现?vxworks下本机的ip还是:127.0.0.1吗??不知道这种方法是否可以实现??… 查看全部问答> |
|
我司开发一个gps的接收终端,要求 1)通过电池/直流电供电 2)定时(如每5秒钟)接收一次gps位置信息,然后保存到终端内的存储卡中 3)终端有一个小屏幕显示一些基本信息,工作状态、时间等 4)终端可以通过usb接入电脑,按fat文件格式,由电脑 ...… 查看全部问答> |




