Compile A Statically Linked PHP With Swoole and other Extensions.
BTW, It's only for CLI mode.
x86_64
and aarch64
platform, others have not tested.You can directly download static binary in Release.
Here's help command to compile it yourself:
git clone https://github.com/crazywhalecc/static-php-cli.git
cd static-php-cli/docker
docker build -t static-php .
After compilation you can use command to get static php binary file:
mkdir dist
docker run --rm -v $(pwd)/dist:/dist/ -it static-php cp php-dist/bin/php /dist/
cd dist
file ./php
To customize PHP extensions, edit docker/extensions.txt
file, and rules below:
#
as comment, to mark not installSupport | PHP Ext Name | Version | Comments |
---|---|---|---|
yes | bcmath | * | |
yes | calendar | * | |
yes | ctype | * | |
yes | curl | * | |
yes | dom | * | |
event | |||
yes | filter | * | |
yes | gd | * | |
yes | hash | * | PHP7.3 or older uses --enable-hash |
yes | iconv | * | |
yes | inotify | 3.0.0 | |
yes | json | * | |
yes | libxml | * | |
yes | mbstring | * | |
yes | mongodb | >=1.9.1 | not tested |
mysqli | |||
yes | mysqlnd | * | |
yes | openssl | * | |
yes | pcntl | * | |
yes | pdo | * | |
yes | pdo_mysql | * | |
pdo_pgsql | * | ||
yes | phar | * | |
yes | posix | * | |
yes | redis | * | |
yes | simplexml | * | |
yes | sockets | * | |
yes | swoole | >=4.6.6 | support mysqlnd, sockets, openssl, redis |
yes | tokenizer | * | |
yes | xml | * | |
yes | xmlreader | * | |
yes | xmlwriter | * | |
zip | |||
yes | zlib | * |
config.m4
and code.--enable-swoole-curl
.After-compile status
Run Workerman directly