Skip to content

Commit

Permalink
Also do this for php
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Muller committed Apr 1, 2015
1 parent 86fe552 commit e915760
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
isset($_SERVER['argv'][0]) && $_SERVER['argv'][0] === 'server.php';

if($scriptInvokedFromCli) {
echo 'starting server on port 3000' . PHP_EOL;
exec('php -S localhost:3000 -t public server.php');
$port = getenv('PORT');
if (empty($port)) {
$port = "3000";
}

echo 'starting server on port '. $port . PHP_EOL;
exec('php -S localhost:'. $port . ' -t public server.php');
} else {
return routeRequest();
}
Expand Down

0 comments on commit e915760

Please sign in to comment.