/*********************************************************************      busybox filesystem httpd php-5.5.31 sqlite3 webserver* 声明:*     本文主要是记录使用httpd、php5、sqlite3搭建php web服务器。**                                 2016-1-24 深圳 南山平山村 曾剑锋*******************************************************************/一、参考文章:1. Run busybox httpd with phphttps://box.matto.nl/busyboxphp.html2. Sqlite undefined reference to `sqlite3_open' error in Netbeans C++ on Ubuntu, Integrating SQLite into Netbeans C++ Ubuntuhttp://stackoverflow.com/questions/3463438/sqlite-undefined-reference-to-sqlite3-open-error-in-netbeans-c-on-ubuntu-in3. 嵌入式WEB服务器移植三部曲之PHP的移植http://blog.csdn.net/cos_sin_tan/article/details/77342784. Real210 编译sqlite错误:.//libsqlite3.a(sqlite3.o): In function `unixDlSym’:http://www.jyguagua.com/?p=9655. 成功移植SQLite3到ARM Linux开发板http://www.myir-tech.com/bbs/thread-6189-1-1.html6. ARM上linux终端操作SQLITE,退格键问题http://www.programgo.com/article/61872541163/7. 用busybox做一个简单的文件系统 http://blog.chinaunix.net/uid-9688646-id-3346880.html8. Using SQLite3 with PHPhttp://babbage.cs.qc.cuny.edu/courses/cs903/2013_02/using_sqlite3.html

二、测试busybox httpd:1. cat /www/index.html<h1>Welcome to Tinyfs</h1><p>zengjf</p>   2. shell命令:/usr/sbin/httpd -vv -f -h /www/3. 查看ARM板IP:[zengjf@root www]# ifconfig eth0eth0      Link encap:Ethernet  HWaddr 1E:ED:19:27:1A:B3  inet addr:10.0.1.52  Bcast:10.0.1.255  Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:39 errors:0 dropped:0 overruns:0 frame:0TX packets:33 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:4990 (4.8 KiB)  TX bytes:4050 (3.9 KiB)[zengjf@root www]# 4. PC机浏览器访问:http://10.0.1.52/
        经验证获取到了正确信息,Vim里贴不上图,就不贴图了。5. shell响应如下:[zengjf@root www]# /usr/sbin/httpd -vv -f -h /www/10.0.1.50:55185: url:/10.0.1.50:55185: response:200
三、编译、安装、测试php-5.5.311. ./configure -host=arm-linux-gnueabihf -prefix=/usr/local/php -disable-all -enable-pdo -with-sqlite3 -with-sqlite -with-pdo-sqlite -with-zlib -without-iconv2. make1. 错误ext/sqlite3/libsqlite/sqlite3.o: In function `unixDlError':/home/Qt/rootfs/busybox/php/php-5.5.31/ext/sqlite3/libsqlite/sqlite3.c:31521: undefined reference to `dlerror'
            ext/sqlite3/libsqlite/sqlite3.o: In function `unixDlClose':/home/Qt/rootfs/busybox/php/php-5.5.31/ext/sqlite3/libsqlite/sqlite3.c:31552: undefined reference to `dlclose'
            ext/sqlite3/libsqlite/sqlite3.o: In function `unixDlSym':/home/Qt/rootfs/busybox/php/php-5.5.31/ext/sqlite3/libsqlite/sqlite3.c:31548: undefined reference to `dlsym'
            ext/sqlite3/libsqlite/sqlite3.o: In function `unixDlOpen':/home/Qt/rootfs/busybox/php/php-5.5.31/ext/sqlite3/libsqlite/sqlite3.c:31507: undefined reference to `dlopen'
            collect2: error: ld returned 1 exit statusmake: *** [sapi/cli/php] Error 12. 解决方法:修改Makefile中的:EXTRA_LIBS = -lcrypt -lcrypt -lrt -lz -lm -lcrypt -lcrypt 为:EXTRA_LIBS = -lcrypt -lcrypt -lrt -lz -lm -lcrypt -lcrypt -ldl3. 效果:end_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo -lcrypt -lcrypt -lrt -lz -lm -lcrypt -lcrypt -ldl  -o sapi/cgi/php-cgiBuild complete.Don't forget to run 'make test'.3. sudo make install4. 拷贝PC机/usr/local/php目录下文件到:<filesystem root>/usr/local/php5. 配置httpd.conf:cat /etc/httpd.conf*.php:/usr/local/php/bin/php-cgi6. cat /www/test.php<?phpinfo();?>7. PC机浏览器访问:http://10.0.1.52/test.php1. 报错现象:This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.For more information as to why this behaviour exists, see the manual page for CGI security.For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.2. 解决办法:将force-cgi-redirect设置disable。8. 查看php.ini位置:[zengjf@root /usr/local/php/bin]# ./php-cgi -i | grep ini<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/usr/local/php/lib </td></tr><tr><td class="e">Loaded Configuration File </td><td class="v">/usr/local/php/lib/php.ini </td></tr><tr><td class="e">Scan this dir for additional .ini files </td><td class="v">(none) </td></tr><tr><td class="e">Additional .ini files parsed </td><td class="v">(none) </td></tr><tr><td class="e">user_ini.cache_ttl</td><td class="v">300</td><td class="v">300</td></tr><tr><td class="e">user_ini.filename</td><td class="v">.user.ini</td><td class="v">.user.ini</td></tr><tr><td class="e">Classes </td><td class="v">AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException </td></tr>9. 配置php.ini:cat /usr/local/php/lib/php.inicgi.force_redirect = 0cgi.redirect_status_env ="yes";10. PC机浏览器访问:http://10.0.1.52/test.php
        经验证获取到了正确信息,Vim里贴不上图,就不贴图了。11. shell响应如下:[zengjf@root /usr/local/php/lib]# /usr/sbin/httpd -vv -f -h /www/10.0.1.50:58652: url:/10.0.1.50:58652: response:20010.0.1.50:58656: url:/test.php四、编译、安装、测试sqlite3:1. ./configure --host=arm-linux-gnueabihf --prefix=/usr/local/sqlite2. make3. sudo make install1. 报错:libtool: install: /usr/bin/install -c .libs/libsqlite3.a /usr/local/sqlite/lib/libsqlite3.alibtool: install: chmod 644 /usr/local/sqlite/lib/libsqlite3.alibtool: install: arm-linux-gnueabihf-ranlib /usr/local/sqlite/lib/libsqlite3.a./libtool: line 1720: arm-linux-gnueabihf-ranlib: command not foundmake[1]: *** [install-libLTLIBRARIES] Error 127make[1]: Leaving directory `/home/Qt/rootfs/busybox/sqlite/sqlite-autoconf-3100200'
            make: *** [install-am] Error 22. 解决方法:是由于使用了sudo,导致环境变丢失,用su切换到root用户,再重新设置环境变量来解决。4. 拷贝/usr/local/sqlite中的文件到<filesystem root>下对应的目录。5. 建立软链接:ln -s /bin/sqlite3 /bin/sqlite6. 不能使用退格键(backspace):1. 错误现象:[zengjf@root ~]# sqliteSQLite version 3.10.2 2016-01-20 15:27:19Enter ".help" for usage hints.Connected to a transient in-memory database.Use ".open FILENAME" to reopen on a persistent database.sqlite> shw^H^H^H^H^H2. 解决方法:终端执行shell命令:stty erase ^H7. 在ARM板上运行效果如下:[zengjf@root ~]# sqliteSQLite version 3.10.2 2016-01-20 15:27:19Enter ".help" for usage hints.Connected to a transient in-memory database.Use ".open FILENAME" to reopen on a persistent database.sqlite> .showecho: offeqp: offexplain: offheaders: offmode: listnullvalue: ""output: stdoutcolseparator: "|"rowseparator: "\n"stats: offwidth: sqlite> .quit[zengjf@root ~]# 8. cat /www/teatdb.php<?$db = new SQLite3('my_database') or die('Unable to open database');$query = <<<EODCREATE TABLE IF NOT EXISTS users (username STRING PRIMARY KEY,password STRING)EOD;    # 这里一定要顶格$db->exec($query) or die('Create db failed');$query = <<<EODINSERT INTO users VALUES ( 'zengjf', 'root' )EOD;    # 这里一定要顶格$db->exec($query) or die("Unable to add user $user");$result = $db->query('SELECT * FROM users') or die('Query failed');while ($row = $result->fetchArray()){echo "User: {$row['username']}\nPasswd: {$row['password']}\n";}?>9. PC机浏览器访问:http://10.0.1.52/testdb.php
        经验证获取到了正确信息,Vim里贴不上图,就不贴图了。10. shell响应如下:[zengjf@root ~]# 127.0.0.1:54905: url:/127.0.0.1:54905: response:20010.0.1.50:51536: url:/testdb.php11. 可能错误:1. Fatal error: Class 'SQLiteDatabase' not found in /www/testdb.php on line 32. 这是由于移植的sqlite3,可能这里使用的是sqlite的接口,使用sqlite3的接口可以避免这个错误。

转载于:https://www.cnblogs.com/zengjfgit/p/5155481.html

busybox filesystem httpd php-5.5.31 sqlite3 webserver相关推荐

  1. g++ linux 编译开栈_使用 linux kernel +busybox 定制linux系统

    写在开头: 本来是想使用linux kernel +busybox 制作一个教程的,后来快要结束的时候,死活找不到硬盘,我了解很多文章都有类似的,但是没有谈到硬盘找不到问题,最后历经艰辛,终于把问题解 ...

  2. 面具busybox模块_使用 linux kernel +busybox 定制linux系统

    目的: 了解linux的启动过程 主要内容: 1.grub 是启动程序的bootloader 2.linux-kernel 是linux的开源内核 3.busybox 是linux的工具集合 启动顺序 ...

  3. 25.0 httpd配置文件 chaos

    httpd初步了解 apache旗下的httpd 目录 #主程序文件 #主进程文件 #帮助文档包 1.显示服务器版本信息 2.修改监听的IP和Port 3.持久连接 4.MPM( Multi-Proc ...

  4. Linux中httpd353错误,linux - 由于控制进程退出并显示错误代码,因此httpd.service的作业失败 - 堆栈内存溢出...

    更改00-nova-placement-api.conf ,我正在虚拟机中研究00-nova-placement-api.conf , 我想重启httpd : systemctl restart ht ...

  5. ramdisk.img

    转载:http://linux.chinaunix.net/techdoc/net/2008/12/25/1054814.shtml ramdisk.img 也可以叫做initrd.img,  它是一 ...

  6. linux 命令总结

    http://linux.chinaunix.net/techdoc/system/2008/03/12/982929.shtml 1. 永久更改ip ifconfig eth0 新ip 然后编辑/e ...

  7. 64位Linux的内核和用户地址空间

    32位的Linux中,0x00000000-0xBFFFFFFFFF 这3GB是 用户空间 0xC00000000-0xFFFFFFFFFF 这1GB是 内核空间 ++++++++++++++++++ ...

  8. corosync+pacemaker+crmsh的高可用web集群的实现

    网络规划: node1:eth0:172.16.31.10/16 node2: eth0: 172.16.31.11/16 nfs:   eth0: 172.16.31.12/15 注: nfs在提供 ...

  9. Linux下性能监控工具介绍

    本章解释如何使用适用于Linux的大量性能工具及每个工具中信息的意义.即使已经使用top或者sar,也可能从本章学到相关知识. 应该养成使用这些工具的习惯.当然要知道如何诊断性能问题,但也应该定期寻找 ...

最新文章

  1. ionic4中使用Swiper触屏滑动---心酸路
  2. python微信库wxpy_使用wxpy这个基于python实现的微信工具库的一些常见问题
  3. 一步一步将自己的代码转换为观察者模式
  4. PyCharm如何集成PyQt
  5. 【待继续研究】解析信用评分模型的开发流程及检验标准(晕乎乎,看不懂~)
  6. 将代码从windows移动linux上出现^M错误的解决方法
  7. windows server 2012 FTP 服务器 / 创建服务器
  8. c语言大作业旋转,c语言大作业全-20210412035629.docx-原创力文档
  9. autohotkey php,Autohotkey+php实现免浏览器听录音
  10. linux远程工具_【linux实操3.1】linux远程连接工具Secure的使用
  11. 判断form表单里面的元素属性是否有数据_html form标签的action属性是什么意思?又有哪些用法?(附实例)...
  12. Routeros2.9.7安装总结
  13. 强烈推荐!大数据领域的顶级开源工具大集合
  14. Java拦截器和过滤器的作用和区别
  15. 红米开发版刷机教程_红米手机稳定版刷机教程(Recovery卡刷)的具体操作方法
  16. 计算机输入法切换用户,电脑输入法切换不了怎么办
  17. java多个文件加密压缩_Java实现自动压缩文件并加密的方法示例
  18. phalcon mysql port_Phalcon数据库抽象层
  19. index函数python查询所有_index函数python查询所有_Python List index()方法
  20. python 图片数据集批量打标签

热门文章

  1. 刚装oracle, 熟悉一下命令
  2. 一个UI布局框架,以最少的代码实现UI设置及布局控制
  3. 第一次阅读java,net.ServerSocket
  4. JS滚轮事件(mousewheel/DOMMouseScroll)了解
  5. Android实现ListView异步加载图片
  6. Exchange 2010 CAS安装之一
  7. C语言open和creat函数
  8. 大数据教程(9.1)流量汇总排序的mr实现
  9. 百万级分组大报表开发与呈现
  10. 美丽的闭包,在js中实现函数重载