Skip to content

Commit 1a21559

Browse files
committed
Fix routes support when using the PHP built-in web server
1 parent 0516ca4 commit 1a21559

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

symfony/framework-bundle/3.3/post-install.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* <fg=blue>Run</> your application:
66
1. Change to the project directory
77
2. Create your code repository with the <comment>git init</comment> command
8-
3. Execute the <comment>php -S 127.0.0.1:8000 -t public</> command
8+
3. Execute the <comment>php -S 127.0.0.1:8000 -t public public/index.php</> command
99
4. Browse to the <comment>http://localhost:8000/</> URL.
1010

1111
Quit the server with CTRL-C.

symfony/framework-bundle/3.3/public/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env));
2020

2121
if ($debug) {
22+
// Compatibility with the built-in PHP web server
23+
if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) {
24+
return false;
25+
}
2226
umask(0000);
2327

2428
Debug::enable();

symfony/framework-bundle/4.2/post-install.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* <fg=blue>Run</> your application:
66
1. Change to the project directory
77
2. Create your code repository with the <comment>git init</comment> command
8-
3. Execute the <comment>php -S 127.0.0.1:8000 -t public</> command
8+
3. Execute the <comment>php -S 127.0.0.1:8000 -t public public/index.php</> command
99
4. Browse to the <comment>http://localhost:8000/</> URL.
1010

1111
Quit the server with CTRL-C.

symfony/framework-bundle/4.2/public/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env));
2020

2121
if ($debug) {
22+
// Compatibility with the built-in PHP web server
23+
if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) {
24+
return false;
25+
}
2226
umask(0000);
2327

2428
Debug::enable();

0 commit comments

Comments
 (0)