Added basic cli web server documentation.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@312768 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2011-07-01 14:09:12 +00:00
parent 17028006b4
commit 5dc9ad2fb7

View file

@ -1579,7 +1579,78 @@ php >
</note>
</section>
<!--}}}-->
<!--Built-in CLI Web Server: {{{-->
<section xml:id="features.commandline.webserver">
<title>Built-in web server</title>
<para>
As of PHP 5.4.0, the &cli.sapi; provides a built-in web server.
</para>
<para>
This web server is designed for developmental purposes only, and should not
be used in production.
</para>
<example>
<title>Loading a file</title>
<programlisting role="shell">
<![CDATA[
$ php -S localhost:8000 test.php
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PHP Development Server is listening on localhost:8000 in . ... Press Ctrl-C to quit.
]]>
</screen>
</example>
<example>
<title>Loading a directory</title>
<programlisting role="shell">
<![CDATA[
$ php -S localhost:8000 -t foo/
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PHP Development Server is listening on localhost:8000 in foo/ ... Press Ctrl-C to quit.
]]>
</screen>
</example>
<example>
<title>Example output while making HTTP requests</title>
<programlisting role="php">
<![CDATA[
<?php
// hello.php
echo htmlspecialchars($_GET['hello'], ENT_QUOTES, 'UTF-8');
?>
]]>
</programlisting>
<programlisting role="shell">
<![CDATA[
$ php -S localhost:8000 hello.php
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
[Fri Jul 1 06:29:04 2011] ::1:63530: /
[Fri Jul 1 06:29:10 2011] ::1:63532: /?hello=world
[Fri Jul 1 06:29:11 2011] ::1:63533: /?hello=you
]]>
</screen>
</example>
</section>
<!--}}}-->
</chapter>
<!-- Keep this comment at the end of the file