php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75583 .html file extension ignored by the built-in server
Submitted: 2017-11-28 00:14 UTC Modified: 2018-02-06 03:23 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: marco dot moura at fatec dot sp dot gov dot br Assigned:
Status: No Feedback Package: Built-in web server
PHP Version: 7.1.12 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marco dot moura at fatec dot sp dot gov dot br
New email:
PHP Version: OS:

 

 [2017-11-28 00:14 UTC] marco dot moura at fatec dot sp dot gov dot br
Description:
------------
When running php -S localhost:8000, or any chosen port number, html files can't be found by the built-in web server. For instance, after creating a folder, adding an index.html file, serving the folder, and accessing it through the web browser, the following error is returned: "The requested resource /index.html was not found on this server". This doesn't happen with .php files though. Tested using PHP version 7.1.12 x64, both Thread-Safe and Non Thread-Safe.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-28 17:17 UTC] cmb@php.net
-Summary: Html mime type ignored by the built-in server +Summary: .html file extension ignored by the built-in server -Status: Open +Status: Verified
 [2017-11-28 17:17 UTC] cmb@php.net
Indeed, while `.htm` is supported, `.html` is not, although the
documentation claims support for `.html`[1].

[1] <www.php.net/manual/en/features.commandline.webserver.php>
 [2018-01-23 03:24 UTC] mattficken@php.net
So you request /index.html and index.html exists but you get a 404 error? or the mime type is wrong?

Please confirm/clarify and I will continue investigating.

I just did a quick check of requests for / /index.htm /index.html and they were returned and the mime-type was returned(text/html). This worked for me on 7.0 and 7.1.5.

The mime_types are registered in mime_type_map.h.

php_cli_server_request_translate_vpath() looks like it should work for both .htm and .html... it just that a request for / will return index.html or index.php but NOT index.htm (as designed).
 [2018-01-23 06:21 UTC] marco dot moura at fatec dot sp dot gov dot br
Dear Matt,

First off, thank you for looking into this. Unfortunately, my Windows environment is gone, and I can't go back into it and test. However, I can confirm that from PHP version 7.2, on Manjaro, I haven't had this problem anymore. Also tested it on Ubuntu 16.04, no signs of the bug. By the way, I did test it by explicitly typing in the file extension back when I reported the bug. And yeah, I was getting a 404 error.

Cheers
 [2018-02-06 03:23 UTC] mattficken@php.net
-Status: Verified +Status: No Feedback
 [2018-02-06 03:23 UTC] mattficken@php.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.

Can't repro. RP doesn't have environment to repro. Reading the code, it seems clear this can't happen.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC