diff --git a/compile_php.sh b/compile_php.sh index f75ae0354..c1ee04dbf 100644 --- a/compile_php.sh +++ b/compile_php.sh @@ -124,6 +124,7 @@ cd php --disable-xmlwriter \ --without-pear \ --enable-sockets \ +--enable-pcntl \ --enable-pthreads \ --enable-maintainer-zts \ --enable-cli >> $DIR/install.log 2>&1 diff --git a/src/classes/PocketMinecraftServer.php b/src/classes/PocketMinecraftServer.php index 66d239c5b..f95c4252c 100644 --- a/src/classes/PocketMinecraftServer.php +++ b/src/classes/PocketMinecraftServer.php @@ -331,6 +331,11 @@ class PocketMinecraftServer{ register_tick_function(array($this, "tick")); register_shutdown_function(array($this, "dumpError")); register_shutdown_function(array($this, "close")); + if(function_exists("pcntl_signal")){ + pcntl_signal(SIGTERM, array($this, "close")); + pcntl_signal(SIGINT, array($this, "close")); + pcntl_signal(SIGHUP, array($this, "close")); + } $this->trigger("server.start", microtime(true)); console("[INFO] Server started!"); $this->process();