Use musleabi on 64-bit Ubuntu14.04 to minimize the cross-compiling Android PHP7 https://bitbucket.org/GregorR/musl-cross/downloads
Crossx86-arm-linux-musleabi-0.9.11.tar.xz (20 MB)
CC = arm-linux-musleabi-gcc \
CXX = arm-linux-musleabi-g ++ \
AR = arm-linux-musleabi-ar \
LD = arm-linux-musleabi-ld \
RANLIB = arm-linux-musleabi-ranlib \
STRIP = arm-linux-musleabi-strip \
CFLAGS = "-OS "\
CXXFLAGS = "-OS "\
./Configure \
-- Host = arm-linux-musleabi \
-- Prefix =/opt/phpdroid/php \
-- Disable-all \
-- Enable-json \
-- Enable-pdo \
With-sqlite3 \
-- With-pdo-sqlite
The PHP source code comes with the PCRE library, which does not depend on the external PCRE library during compilation. Therefore, you do not need to compile the PCRE library and configure CPPFLAGS and LDFLAGS parameters:
CPPFLAGS = "-I/png/dev/android/compiled/usr/include "\
LDFLAGS = "-static-L/png/dev/android/compiled/usr/lib "\
Sed-I "s {/bin/sh {/system/bin/sh {" ext/standard/proc_open.c
Sed-I "s {-export-dynamic {-all-static {" Makefile
Sed-I "s {-export-dynamic {-all-static {" Makefile compiled:
./Php-v returned-bash:./php: No such file or directory
File./php returns php: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
Normally, php: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
Time nice-20 make-j2
Make install
Arm-linux-musleabi-strip/opt/phpdroid/php/bin/php
Xz-z-k-9/opt/phpdroid/php/bin/php
Strip is less than 4 MB, and xz is compressed to about 1 MB.
It is 2.7 MB smaller than php. xz, and the PHPDroid APK package can be reduced from 5.7MB to 3 MB.
Download: php-7.0.6-arm-linux.xz (1.1 MB)
./Php-m
[PHP Modules]
Core
Date
Json
Pcre
PDO
Pdo_sqlite
Reflection
SPL
Sqlite3
Standard
./Php-r 'print _ r (get_defined_functions (); '> func.txt
./Php-r 'print _ r (get_declared_classes (); '> class.txt
It can be seen that it includes the following common functions:
Pdo_sqlite
Json_encode/json_decode
File_get_contents/file_put_contents
Note: without OpenSSL support, file_put_contents does not support HTTPS.
./Php-r "file_put_contents('logo.gif ', file_get_contents ('https: // www.baidu.com/img/bdlogo.gif '));"