Re: RFC: built-in web server in CLI.
| From: | Ángel González | Date: | Wed, 02 Mar 2011 23:05:26 +0000 |
| Subject: | Re: RFC: built-in web server in CLI. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51549@lists.php.net to get a copy of this message | ||
Moriyoshi Koizumi wrote:
> Hi,
>
> Just to let you know that I wrote a RFC about built-in web server
> feature with which PHP can serve contents without a help of web
> servers. That would be handy for development purpose.
>
> If interested, have a look at
> http://wiki.php.net/rfc/builtinwebserver .
>
> Regards,
> Moriyoshi
I like the idea.
Regarding the patch (https://gist.github.com/835698):
I don't see a switch to disable the internal parse on configure.
I'd expect the files to be on its own folder inside sapi, even being
able to
bundle them in a single binary.
Why is this needed on WIndows?
+ ADD_FLAG("LIBS_CLI", "ws2_32.lib");
Surely php will already link with the sockets library for its own functions.
The http parser code seems copied from https://github.com/ry/http-parser and
it may not be a good idea to modify it downstream, but it seems to do more
things than strictly needed by php (eg. there are more methods than those a
php server would take use).
It also seems to be a hand-coded lexer, so that's much more verbose than a
set of rules.
The patch looks messy as it splits main in two functions, so it gets
hard to follow,
but is probably good overall.
The change from php_printf to printf in line 3988 looks wrong.
Any special reason to disable it on PHP_CLI_WIN32_NO_CONSOLE ?