Update README-en.md

This commit is contained in:
Whale 2021-06-06 11:41:55 +08:00 committed by GitHub
parent cb679247fc
commit de5d92be70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,72 +1,92 @@
# static-php-swoole
Compile A Statically Linked PHP With Swoole and other Extensions. [English README](/README-en.md)
Compile A Statically Linked PHP With Swoole and other Extensions.
BTW, It's only for CLI mode.
[![version](https://img.shields.io/badge/version-1.2.0-green.svg)]()
[![version](https://img.shields.io/badge/version-1.3.0-green.svg)]()
## Requirements
- Tested on `x86_64` and `aarch64` platform, others have not tested.
- Requiring Alpine Linux (version >= 3.13), or requiring musl-libc
- Support WSL2
- Supporting PHP version >= 7.3
- Docker required (or alpine linux when I write single script file)
- Supporting PHP version from 7.2 to 8.0
## Start
You can directly download static binary in Release.
Here's help command to compile it yourself:
```bash
# Compile script
./static-compile-php.sh
# And now you get `php-dist/bin/php` file!
git clone https://github.com/crazywhalecc/static-php-cli.git
cd static-php-cli/docker
docker build -t static-php .
```
## Library version
- php: 7.4.18
- libxml2: 2.9.10
- curl: 7.76.1
After compilation you can use command to get static php binary file:
```bash
mkdir dist
docker run --rm -v $(pwd)/dist:/dist/ -it static-php cp php-dist/bin/php /dist/
cd dist
file ./php
```
## Including PHP extensions
- bcmath
- calendar
- ctype
- filter
- openssl
- pcntl
- iconv
- inotify (3.0.0)
- json
- mbstring
- phar
- curl
- pdo
- gd
- pdo_mysql
- mysqlnd
- sockets
- swoole (4.6.6)
- redis (5.3.4)
- simplexml
- dom
- xml
- xmlwriter
- xmlreader
- posix
- tokenizer
To customize PHP extensions, edit `docker/extensions.txt` file, and rules below:
- Use `#` as comment, to mark not install
- extensions name uses lower case, and default file contains all supported extensions, if u need other extensions, consider write an Issue
## Supported PHP extensions
| Support | 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 | * | |
## Current Issue
- [ ] Not support event(libevent), because of its `config.m4` and code.
- [ ] Swoole not support `--enable-swoole-curl`.
- [ ] Not support readline, maybe caused by ncurses library.
- [X] Not support curl (solved)
- [X] Customize extensions to compile
- [ ] php.ini integration
- [X] i18n (including README and scripts)
## Running preview
After-compile status
![image](https://user-images.githubusercontent.com/20330940/116291663-6df47580-a7c7-11eb-8df3-6340c6f87055.png)
Run Swoft framework directly
![image](https://user-images.githubusercontent.com/20330940/116053161-f16d7400-a6ac-11eb-87b8-e510c6454861.png)
![image](https://user-images.githubusercontent.com/20330940/120911319-219b3000-c6b9-11eb-82d1-b4309cfca8b3.png)
## Todo List
- [X] curl/libcurl extension support
- [ ] Alternative extension compiling
- [ ] php.ini support
- [ ] Make composer together
- [ ] i18n
Run Workerman directly
![image](https://user-images.githubusercontent.com/20330940/120911301-f7e20900-c6b8-11eb-99eb-ebc84ab95df0.png)
## References
- <https://blog.terrywh.net/post/2019/php-static-openssl/>