@@ -15,8 +15,11 @@ a full-featured web server such as
1515 The built-in web server is meant to be run in a controlled environment.
1616 It is not designed to be used on public networks.
1717
18+ Running the Server in the Foreground
19+ ------------------------------------
20+
1821Starting the Web Server
19- -----------------------
22+ ~~~~~~~~~~~~~~~~~~~~~~~
2023
2124Running a Symfony application using PHP's built-in web server is as easy as
2225executing the ``server:run `` command:
@@ -37,7 +40,7 @@ can change the socket passing an ip address and a port as a command-line argumen
3740 $ php app/console server:run 192.168.0.1:8080
3841
3942 Command Options
40- ---------------
43+ ~~~~~~~~~~~~~~~
4144
4245The built-in web server expects a "router" script (read about the "router"
4346script on `php.net `_) as an argument. Symfony already passes such a router
@@ -58,3 +61,61 @@ you have to pass the correct location using the ``--docroot`` option:
5861
5962 .. _`built-in web server` :http://www.php.net/manual/en/features.commandline.webserver.php
6063.. _`php.net` :http://php.net/manual/en/features.commandline.webserver.php#example-401
64+
65+ Moving the Process to the Background
66+ ------------------------------------
67+
68+ ..versionadded ::2.6
69+ The ability to run the server as a background process was introduced
70+ in Symfony 2.6.
71+
72+ The ``server:run `` command runs the web server in the foreground blocking
73+ the current terminal window. You can also run the server in a background process:
74+
75+ ..code-block ::bash
76+
77+ $ php app/console server:start
78+
79+ The ``server:start `` command accepts the same options and arguments as the
80+ ``server:run `` command. For example, the following command will tell the server
81+ to listen on port 8080 on the network interface with the 192.168.0.1 ip address
82+ assigned to:
83+
84+ ..code-block ::bash
85+
86+ $ php app/console server:start 192.168.0.1:8080
87+
88+ This way, you can start several server processes listening on different sockets
89+ without bothering with a clutter of terminal windows.
90+
91+ Stopping the Server
92+ ~~~~~~~~~~~~~~~~~~~
93+
94+ To stop a server running in the background, you simply call the ``server:stop ``
95+ command passing it the socket the server is listening on.
96+
97+ ..code-block ::bash
98+
99+ $ php app/console server:stop 127.0.0.1:8080
100+
101+ Similar to the commands that are used to start the web server, omitting the
102+ socket argument for the ``server:stop `` command stops the server listening
103+ on port 8000 on the loopback device.
104+
105+ Monitoring the Server Status
106+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107+
108+ You can check status of the web server for a particular socket using the ``server:status ``
109+ command (127.0.0.1:8000 being the default socket again):
110+
111+ ..code-block ::bash
112+
113+ $ php app/console server:status 127.0.0.1:8080
114+
115+ ..caution ::
116+
117+ The information shown by the ``server:status `` command would not be reliable
118+ if you didn't terminate the server using the ``server:stop `` command (by
119+ using the UNIX ``kill `` command or the Windows task manager, for example).
120+
121+ .. _`built-in web server` :http://www.php.net/manual/en/features.commandline.webserver.php