Simple scripts for controlling the lifecycle of PocketMine servers
This is a proof of concept that is tested on Windows.
- Get a clean installation of PocketMine-MP using the PocketMine installer.
- Download
php/functions.phpandphp/wrapper.phptogether into anywhere in your system. - Open command terminal and
cdto your PocketMine-MP install directory. If./PocketMine-MP.pharis absent, the script will attempt to loadsrc/pocketmine/PocketMine.php(run-from-source) instead. - Run your downloaded
php/wrapper.phpwith PHP (with the current working directory at your PocketMine-MP install directory!). You are recommended to use the PHP binaries provided by PocketMine-MP installer, since thephp_pthreadsextension is required. For example, on Windows:
bin\php\php.exe %USERPROFILE%\Downloads\wrapper.php
Note: To avoid warnings related to timezones, edit your
php.ini(usually next to yourphp.exe) and add this line:date.timezone=Asia/Hong_KongReplace Asia/Hong_Kong with your timezone (https://php.net/timezones)
- Type
0to make server run for infinite times, type1to run server once only,2for twice, vice versa. Then click enter. - After that, the server will start and you can use the terminal like normal console.
- To shutdown the server (like
/stop) and then stop restarting, type-diethen enter. - To forcefully shutdown the server, type
-killthen enter. - To get the process ID of the wrapper (not the PocketMine server), type
-mypidthen enter. - To get the process ID of the PocketMine server (not the wrapper), type
-pmpidthen enter.