Bug #74570 [Opn->Nab]: Not Found in JS, CSS and IMG files
| From: | kelunik@php.net | Date: | Wed, 10 May 2017 20:20:57 +0000 |
| Subject: | Bug #74570 [Opn->Nab]: Not Found in JS, CSS and IMG files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209049@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74570&edit=1
ID: 74570
Updated by: kelunik@php.net
Reported by: mariombn at gmail dot com
Summary: Not Found in JS, CSS and IMG files
-Status: Open
+Status: Not a bug
Type: Bug
Package: Built-in web server
Operating System: Windows 7
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
Just verified it works. You're probably not in the right directory. The built-in server uses
the current directory as document root by default. You can change the document root by using the -t
flag.
$ php -S localhost:8000 -t php-test php-test/index.php
PHP 7.1.3 Development Server started at Wed May 10 22:17:29 2017
Listening on http://localhost:8000
Document root is /home/kelunik/GitHub/kelunik/php-test
^------------------------------------
The used document root is also printed on startup as you can see above.
Previous Comments:
------------------------------------------------------------------------
[2017-05-10 20:05:45] mariombn at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/features.commandline.webserver
---
Create a router.php file in the public root of my project that is meant to be an alternative to my
.htaccess file when using the built-in PHP web server.
Even using example # 3 of the documentation, none of the exception files such as .png, .jpg or
others that I have added as .js and .css are not loaded. If I call them directly through the
browser, the Not Found error is displayed, The requested resource /assets/css/bootstrap.min.css was
not found on this server.
Test script:
---------------
<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is.
} else {
include "public/index.php";
}
?>
Before, use comando: $php -S 127.0.0.1 public/route.php
Expected result:
----------------
My CSS and JavaScript uploaded successfully
Actual result:
--------------
Not Found
The requested resource /assets/css/bootstrap.min.css was not found on this server.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74570&edit=1