Fix routes support when using the PHP built-in web server

This commit is contained in:
Kévin Dunglas
2018-10-12 09:43:07 +02:00
parent 0516ca4016
commit 1a21559912
4 changed files with 10 additions and 2 deletions
@@ -5,7 +5,7 @@
* <fg=blue>Run</> your application:
1. Change to the project directory
2. Create your code repository with the <comment>git init</comment> command
3. Execute the <comment>php -S 127.0.0.1:8000 -t public</> command
3. Execute the <comment>php -S 127.0.0.1:8000 -t public public/index.php</> command
4. Browse to the <comment>http://localhost:8000/</> URL.
Quit the server with CTRL-C.
@@ -19,6 +19,10 @@ $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env));
if ($debug) {
// Compatibility with the built-in PHP web server
if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) {
return false;
}
umask(0000);
Debug::enable();
@@ -5,7 +5,7 @@
* <fg=blue>Run</> your application:
1. Change to the project directory
2. Create your code repository with the <comment>git init</comment> command
3. Execute the <comment>php -S 127.0.0.1:8000 -t public</> command
3. Execute the <comment>php -S 127.0.0.1:8000 -t public public/index.php</> command
4. Browse to the <comment>http://localhost:8000/</> URL.
Quit the server with CTRL-C.
@@ -19,6 +19,10 @@ $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env));
if ($debug) {
// Compatibility with the built-in PHP web server
if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) {
return false;
}
umask(0000);
Debug::enable();