rfc:builtinwebserver
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:builtinwebserver [2011/03/02 20:48] – created moriyoshi | rfc:builtinwebserver [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Request for Comments: Built-in web server ====== | ====== Request for Comments: Built-in web server ====== | ||
* Version: 1.0 | * Version: 1.0 | ||
- | * Date: 2011-03-06 | + | * Date: 2011-06-020 |
* Author: Moriyoshi Koizumi < | * Author: Moriyoshi Koizumi < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
* Other formats .. | * Other formats .. | ||
Line 9: | Line 9: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | When it comes to web development, | + | When it comes to web development, |
- | While PHP is capable enough to write a standalone web server in thanks to the enhanced stream APIs, writing | + | While PHP is capable enough to write a standalone web server in, thanks to the enhanced stream APIs, writing |
Therefore, it is natural that CLI version of PHP has a feature that the binary itself can be a web server. | Therefore, it is natural that CLI version of PHP has a feature that the binary itself can be a web server. | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | CLI version of PHP will have a new command-line option -S followed by a host address | + | CLI version of PHP will have a new command-line option -S followed by a host address |
- | < | + | |
- | php -S localhost: | + | php -S localhost: |
- | </code> | + | |
+ | with the following output: | ||
+ | |||
+ | Server is listening on localhost: | ||
+ | |||
+ | Every request will be shown in the console as well. | ||
+ | |||
+ | Server is listening on localhost: | ||
+ | [Thu Mar 3 05:42:06 2011] :: | ||
+ | [Thu Mar 3 05:42:06 2011] ::1:56259: /? | ||
+ | [Thu Mar 3 05:42:06 2011] ::1:56260: /? | ||
==== Specifying Document Root ==== | ==== Specifying Document Root ==== | ||
- | The document root can be specified through | + | The document root can be specified through |
- | < | + | |
- | php -S localhost: | + | |
- | </ | + | ==== Directory Indexes ==== |
+ | |||
+ | If a request is made for a directory, the web server will return index.html or index.php if they exist in the directory. | ||
==== Router Script ==== | ==== Router Script ==== | ||
Quite a few number of web applications rely on the URL rewrite feature of the web server to do the custom routing on pretty paths. | Quite a few number of web applications rely on the URL rewrite feature of the web server to do the custom routing on pretty paths. | ||
- | < | + | |
- | php -S localhost: | + | |
- | </ | + | |
- | If the path to a file is given in place of document root, the file will be regarded as a router script and the document root will then be set to the directory where it belongs. | + | If the path to a file is given, the file will be regarded as a router script and the document root will then be set to the directory where it belongs. |
<code php> | <code php> | ||
Line 54: | Line 64: | ||
===== Changelog ===== | ===== Changelog ===== | ||
2011-03-03: initial version | 2011-03-03: initial version | ||
- | |||
- |
rfc/builtinwebserver.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1