php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68236 built-in server relative paths fail
Submitted: 2014-10-15 16:42 UTC Modified: 2014-12-30 10:42 UTC
From: ibt dot zee at gmail dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.6.1 OS: Windows XP/7/8/10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-10-15 16:42 UTC] ibt dot zee at gmail dot com
Description:
------------
Using php built-in server : php.exe -S 127.0.0.1 -t c:\myWebRoot

if a relative path is used in a sub-folder the server assume the root as beeing that folder (the assumed root should always be the root indicated in the command line, in this case was c:\myWebRoot, this would prevent this strange fails)

took me quite a while to understand why my sites worked ok in IIS, LAMP, WAMP, any Apache server... but failed using php built-in server...

As this built-in server is a excelent and useful resource, 
I urge you to solve this odd behaviour... for versions 5.4.x and 5.6.x





Test script:
---------------
no script, 
this will happen even with a simple HTML static page link <a> from any subfolder
as you click the link (if it has a relative path, for example other html file in the same folder) php-server try to find it in root...

wwwroot
    index.html

    images_folder
        any_image.png

    pages_folder
        page1.html
        page2.html

if you have a link <a> in page1.html that is inside pages_folder
and that link jumps to page2.html
php built-in server will fail to retrive page2.html because is looking for
/page2.html instead of ./page2.html
the problem is that assume the current folder as root to search for relative links








Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-15 17:33 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-10-15 17:33 UTC] requinix@php.net
The server does not resolve relative paths - the browser does. If you put output and click a link to "../index.html" then the server will receive a request for /index.html.

What is the exact <a href> in question?
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC