Skip to content

Commit 9e3affb

Browse files
committed
doing a check for default PHP server var. if it doesn't exist check for phpBin option
1 parent 22ac80d commit 9e3affb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PatternLab/Console/Commands/ServerCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,17 @@ public function run() {
5252
$null = Console::findCommandOption("quiet");
5353
$null = $null ? " >& /dev/null" : "";
5454

55+
$php = isset($_SERVER["_"]) ? $_SERVER["_"] : Config::getOption("phpBin");
56+
57+
if (!$php) {
58+
$configPath = Console::getHumanReadablePath(Config::getOption("configPath"));
59+
Console::writeError("please add the option `phpBin` with the path to PHP to <path>".$configPath."</path> before running the server...");
60+
}
61+
5562
// start-up the server with the router
5663
Console::writeInfo("server started on http://".$host." - use ctrl+c to exit...");
5764

58-
passthru("cd ".$publicDir." && ".$_SERVER["_"]." -S ".$host." ".$coreDir."/server/router.php".$null);
65+
passthru("cd ".$publicDir." && ".$php." -S ".$host." ".$coreDir."/server/router.php".$null);
5966

6067
}
6168

0 commit comments

Comments
 (0)