Skip to content

Commit

Permalink
Make nicer errors for PHP binary not being found
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Nov 30, 2021
1 parent 7665f4f commit d535f02
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
17 changes: 15 additions & 2 deletions start.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
7 changes: 6 additions & 1 deletion start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""){
Expand Down

0 comments on commit d535f02

Please sign in to comment.