From 931053bd64c9387e6565a4129b50eecfcc6359b8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 10 Aug 2017 16:57:52 +0200 Subject: [PATCH 1/3] Reworded the built-in web server articles for Symfony 3.3 --- setup.rst | 14 +++++++++----- setup/built_in_web_server.rst | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/setup.rst b/setup.rst index 51c20a9a0c8..d43d93df55a 100644 --- a/setup.rst +++ b/setup.rst @@ -158,16 +158,20 @@ the ``create-project`` command: Running the Symfony Application ------------------------------- -Symfony leverages the internal PHP web server (available since PHP 5.4) to run -applications while developing them. Therefore, running a Symfony application is -a matter of browsing to the project directory and executing this command: +In production servers, Symfony applications use web servers such as Apache or +Nginx (see :doc:`configuring a web server to run Symfony `). +However, in your local development machine you can also use the web server +provided by Symfony, which in turn uses the built-in web server provided by PHP. + +First, :doc:`install the Symfony Web Server ` and +then, execute this command: .. code-block:: terminal $ cd my_project_name/ $ php bin/console server:run -Then, open your browser and access the ``http://localhost:8000/`` URL to see the +Open your browser and access the ``http://localhost:8000/`` URL to see the Welcome Page of Symfony: .. image:: /_images/quick_tour/welcome.png @@ -184,7 +188,7 @@ pressing ``Ctrl+C`` from the terminal or command console. .. tip:: - PHP's internal web server is great for developing, but should **not** be + Symfony's web server is great for developing, but should **not** be used on production. Instead, use Apache or Nginx. See :doc:`/setup/web_server_configuration`. diff --git a/setup/built_in_web_server.rst b/setup/built_in_web_server.rst index d8d74dac183..79f42f984d5 100644 --- a/setup/built_in_web_server.rst +++ b/setup/built_in_web_server.rst @@ -15,6 +15,42 @@ a full-featured web server such as The built-in web server is meant to be run in a controlled environment. It is not designed to be used on public networks. +Symfony provides a web server built on top of this PHP server to simplify your +local setup. This server is distributed as a bundle, so you must first install +and enable the server bundle. + +Installing the Web Server Bundle +-------------------------------- + +First, execute this command: + +.. terminal:: + + $ cd your-project/ + $ composer require symfony/web-server-bundle + +Then, enable the bundle in the kernel of the application:: + + // app/AppKernel.php + class AppKernel extends Kernel + { + public function registerBundles() + { + $bundles = array( + // ... + + if (in_array($this->getEnvironment(), array('dev', 'test'))) { + // ... + $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + } + ); + + // ... + } + + // ... + } + Starting the Web Server ----------------------- From 32daf702b668333fead920084f48ec97c8d1bfd8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 13 Aug 2017 18:59:24 +0200 Subject: [PATCH 2/3] Fixed RST syntax --- setup/built_in_web_server.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/built_in_web_server.rst b/setup/built_in_web_server.rst index 79f42f984d5..7bd75d2473a 100644 --- a/setup/built_in_web_server.rst +++ b/setup/built_in_web_server.rst @@ -24,7 +24,7 @@ Installing the Web Server Bundle First, execute this command: -.. terminal:: +.. code-block:: terminal $ cd your-project/ $ composer require symfony/web-server-bundle From 7cf41242b2a9325f6c5d7f1fe22f20bb25c73753 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 1 Sep 2017 17:39:31 +0200 Subject: [PATCH 3/3] Simplification --- setup/built_in_web_server.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/built_in_web_server.rst b/setup/built_in_web_server.rst index 7bd75d2473a..edcb58b0768 100644 --- a/setup/built_in_web_server.rst +++ b/setup/built_in_web_server.rst @@ -39,7 +39,7 @@ Then, enable the bundle in the kernel of the application:: $bundles = array( // ... - if (in_array($this->getEnvironment(), array('dev', 'test'))) { + if ('dev' === $this->getEnvironment()) { // ... $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); }