I learned PHP seven years ago just to write PocketMine plugins, and now I'm getting ready to try setting up a bedrock server again, and it suddenly occurred to me that it would be possible to apply the static-php-cli I've been maintaining recently to pmmp?
The result is successful but not perfect. Here is a demo:
I also entered the game and connected to the server. Currently, it runs normally without any plugins.
Problems I found
pmmp console input cannot be used with micro SAPI, because micro SAPI PHP_BINARY is empty, there is no php-cli executable.
phar file loading is not working perfectly (usually I use micro with phar needs require_once at the entry of phar).
the executable must be named with yyy.xxx (contains dot).
Warning message: Debugging assertions are enabled
I also tried to use --build-cli to generate standalone php and conducted a series of experiments on both macOS and Linux. An independent php-cli is currently more stable. But I don't have enough insight into how pmmp works and the stability of standalone version of these patched PHP extensions.
Anyway, I learned a lot of interesting extensions through this project of pmmp, and I am happy to show my experiments.
I learned PHP seven years ago just to write PocketMine plugins, and now I'm getting ready to try setting up a bedrock server again, and it suddenly occurred to me that it would be possible to apply the static-php-cli I've been maintaining recently to pmmp?
The result is successful but not perfect. Here is a demo:
pmmp-bin-linux-x86_64.zip
My build steps
bin/spc download --for-extensions=pmmp-chunkutils2,curl,crypto,ctype,gmp,leveldb,mbstring,mbregex,morton,openssl,pmmpthread,sockets,yaml,zip,igbinary,zlib,phar,opcache --with-php=8.2 --debug
.bin/spc build pmmp-chunkutils2,curl,crypto,ctype,gmp,leveldb,mbstring,mbregex,morton,openssl,pmmpthread,sockets,yaml,zip,igbinary,zlib,phar,opcache --build-cli --build-micro --enable-zts --debug --with-micro-fake-cli
.cat buildroot/bin/micro.sfx PocketMine-MP.phar > pmmp.app
.chmod +x pmmp.app
../pmmp.app
.pmmp.yml -> console.input: false
../pmmp.app
.I also entered the game and connected to the server. Currently, it runs normally without any plugins.
Problems I found
PHP_BINARY
is empty, there is nophp-cli
executable.require_once
at the entry of phar).yyy.xxx
(contains dot).Debugging assertions are enabled
I also tried to use
--build-cli
to generate standalone php and conducted a series of experiments on both macOS and Linux. An independent php-cli is currently more stable. But I don't have enough insight into how pmmp works and the stability of standalone version of these patched PHP extensions.Anyway, I learned a lot of interesting extensions through this project of pmmp, and I am happy to show my experiments.