busyboxfilesystemmatrix-gui-2.0undefinedfunctionjson_encode()
/******************************************************************************** * matrix-gui-2.0 undefined function json_encode() * 宣告: * 本文解決matrix-gui-2.0中遇到的: * Fatal error: * Call to undefined function json_encode() in /www/generate.php on line 134 * 以及busybox httpd找不到index.html,主要是由於index.html被替換成了index.php * * 2016-1-31 深圳 南山平山村 曾劍鋒 *******************************************************************************/ 一、參考文章: 1. PHP移植 http://www.cnblogs.com/dancheblog/p/3508675.html 2. Ubuntu Correct path to libxml2 when configuring PHP 5 https://www.howtoforge.com/community/threads/ubuntu-correct-path-to-libxml2-when-configuring-php-5.9982/ 3. 編譯安裝php http://www.cnblogs.com/alexqdh/archive/2012/11/20/2776017.html 4. linux下安裝PHP出現錯誤 求助大家了 http://bbs.chinaunix.net/thread-1962843-1-1.html 5. Using the busybox HTTP server http://wiki.chumby.com/index.php?title=Using_the_busybox_HTTP_server 二、下載、編譯libxml2-2.7.6.tar.gz 1. https://buildroot.org/downloads/ 2. sudo ./configure --host=arm-linux-gnueabihf --prefix=/usr/local/php && make && make install 3. 注意配置好編譯器環境變數。 三、 下載、編譯zlib-1.2.8.tar.gz 1. http://www.zlib.net/ 2. sudo CC=arm-linux-gnueabihf-gcc ./configure --shared --prefix=/usr/local/php && make && make install 3. 注意配置好編譯器環境變數。 四、重新編譯php-5.5.31.tar.bz2 ./configure --host=arm-linux-gnueabihf --prefix=/usr/local/php --disable-all --enable-fastcgi --enable-session --enable-tokenizer --enable-pdo --with-sqlite --with-sqlite3 --with-pdo-sqlite --with-pcre-regex --without-iconv --with-libxml-dir=/usr/local/php --enable-libxml --enable-spl --enable-simplexml --enable-json --with-zlib --with-zlib-dir=/usr/local/php 五、error: 1. 錯誤1: 1. 錯誤現象: ...... checking whether to enable LIBXML support... yes checking libxml2 install dir... no checking for xml2-config path... (cached) /usr/bin/xml2-config configure: error: xml2-config not found. Please check your libxml2 installation. 2. 解決辦法: 1. 編譯安裝:libxml2-2.7.6.tar.gz 2. php-5.5.31加入編譯條件(目錄根據自己前面編譯libxml是寫的目錄): --enable-libxml --with-libxml-dir=/home/Qt/rootfs/busybox/php/libxml2-2.7.6 2. 錯誤2: 1. 錯誤現象: ...... checking for strftime... (cached) yes checking which regex library to use... php checking whether to enable LIBXML support... yes checking libxml2 install dir... /home/Qt/rootfs/busybox/php/libxml2-2.7.6 checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. 2. 解決辦法:“ sudo apt-get install libxml2-dev 3. 錯誤3: 1. 錯誤現象: ...... checking whether to enable the SQLite3 extension... yes checking bundled sqlite3 library... yes checking for ZLIB support... yes checking if the location of ZLIB install directory is defined... no checking for zlib version >= 1.2.0.4... 1.2.3.4 checking for gzgets in -lz... no configure: error: ZLIB extension requires gzgets in zlib 2. 解決辦法: 1. 編譯安裝:zlib-1.2.8.tar.gz 2. php-5.5.31加入編譯條件(目錄根據自己前面編譯zlib是寫的目錄): --with-zlib --with-zlib-dir=/usr/local/php 六、matrix_gui 404 找不到index.html: 1. 這可能是由於busybox的httpd預設識別的index.html,但我們的是index.php; 2. 由上可知,我們需要在matrix_gui中指定我們需要訪問的是index.php; 3. 當然,我們也是可以在/etc/httpd.conf配置: I:index.php # Show index.php when a directory is requested 七、總結: zlib最好要先於libxml2編譯,同時在編譯libxml2的時候將zlib的安裝目錄放置於PATH最前面。