Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit e915760

Browse files
author
Edward Muller
committed
Also do this for php
1 parent 86fe552 commit e915760

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

server.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
isset($_SERVER['argv'][0]) && $_SERVER['argv'][0] === 'server.php';
44

55
if($scriptInvokedFromCli) {
6-
echo 'starting server on port 3000' . PHP_EOL;
7-
exec('php -S localhost:3000 -t public server.php');
6+
$port = getenv('PORT');
7+
if (empty($port)) {
8+
$port = "3000";
9+
}
10+
11+
echo 'starting server on port '. $port . PHP_EOL;
12+
exec('php -S localhost:'. $port . ' -t public server.php');
813
} else {
914
return routeRequest();
1015
}

0 commit comments

Comments
 (0)