diff --git a/start.cmd b/start.cmd index 929e5f7bb..747716ff8 100644 --- a/start.cmd +++ b/start.cmd @@ -2,11 +2,24 @@ TITLE PocketMine-MP server software for Minecraft: Bedrock Edition cd /d %~dp0 +set PHP_BINARY= + +where /q php.exe +if %ERRORLEVEL%==0 ( + set PHP_BINARY=php +) + if exist bin\php\php.exe ( + rem always use the local PHP binary if it exists set PHPRC="" set PHP_BINARY=bin\php\php.exe -) else ( - set PHP_BINARY=php +) + +if "%PHP_BINARY%"=="" ( + echo Couldn't find a PHP binary in system PATH or %~dp0\bin\php + echo Please refer to the installation instructions at https://doc.pmmp.io/en/rtfd/installation.html + pause + exit 1 ) if exist PocketMine-MP.phar ( diff --git a/start.ps1 b/start.ps1 index 2528dd691..19b2a6158 100644 --- a/start.ps1 +++ b/start.ps1 @@ -11,8 +11,13 @@ if($php -ne ""){ }elseif(Test-Path "bin\php\php.exe"){ $env:PHPRC = "" $binary = "bin\php\php.exe" -}else{ +}elseif((Get-Command php -ErrorAction SilentlyContinue)){ $binary = "php" +}else{ + echo "Couldn't find a PHP binary in system PATH or $pwd\bin\php" + echo "Please refer to the installation instructions at https://doc.pmmp.io/en/rtfd/installation.html" + pause + exit 1 } if($file -eq ""){