Skip to content

Commit c694d72

Browse files
committed
make sure the user is running PHP 5.4.0 to use the built-in server
1 parent e3be563 commit c694d72

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/PatternLab/Console/Commands/ServerCommand.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ public function __construct() {
2929

3030
public function run() {
3131

32-
// set-up defaults
33-
$publicDir = Config::getOption("publicDir");
34-
$coreDir = Config::getOption("coreDir");
35-
36-
Console::writeInfo("server started on localhost:8080. use ctrl+c to exit...");
37-
passthru("cd ".$publicDir." && ".$_SERVER["_"]." -S localhost:8080 ".$coreDir."/server/router.php");
32+
if (version_compare(phpversion(), '5.4.0', '<')) {
33+
34+
Console::writeWarning("you must have PHP 5.4.0 or greater to use this feature. you are using PHP ".phpversion()."...");
35+
36+
} else {
37+
38+
// set-up defaults
39+
$publicDir = Config::getOption("publicDir");
40+
$coreDir = Config::getOption("coreDir");
41+
42+
// start-up the server with the router
43+
Console::writeInfo("server started on localhost:8080. use ctrl+c to exit...");
44+
passthru("cd ".$publicDir." && ".$_SERVER["_"]." -S localhost:8080 ".$coreDir."/server/router.php");
45+
46+
}
3847

3948
}
4049

0 commit comments

Comments
 (0)