|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75604 Router script looked up relative to webroot
Submitted: 2017-11-30 17:56 UTC Modified: 2018-01-12 17:21 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: Assigned: nikic (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.2.0 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 + 23 = ?
Subscribe to this entry?

 [2017-11-30 17:56 UTC]
Running the built-in webserver with an explicit webroot (-t
option) causes the router script to be looked up relative to the
webroot, but not to the CWD as before.

Apparently, this regression has been introduced when fixing bug

[1] <;a=commit;h=816758eda2bcdd69ba505fb6bbb79124a7bf2254>

Test script:
cat router.php
start php -S localhost:8080 -t www router.php
wget -qO- http://localhost:8080

Expected result:

echo 'hi';


Actual result:

echo 'hi';

<br />
<b>Warning</b>:  Unknown: failed to open stream: No such file or directory in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Fatal error</b>:  Unknown: Failed opening required 'C:\php-sdk\phpmaster\vc15\x64\www\router.php' (include_path='.;C:\php\pear') in <b>Unknown</b> on line <b>0</b><br />


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-30 17:56 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: laruence
 [2017-11-30 17:56 UTC]
Laruence, can you please have a look at this issue?
 [2017-12-02 11:25 UTC]
I think this is expected, you should use an absoulte path of router , if you don't want  php search it in document_root.
 [2017-12-02 11:44 UTC]
> I think this is expected, […]

That would be a BC break, though, since formerly the router script
was looked up relative to the CWD where the webserver has been
started.  This would at least have to be documented.
 [2017-12-04 08:23 UTC]
-Package: Built-in web server +Package: Documentation problem -Assigned To: laruence +Assigned To:
 [2018-01-12 17:21 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-01-12 17:21 UTC]
I have reverted the fix for bug #75287 to restore the old behavior.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jan 27 02:05:53 2023 UTC