Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c4cd17

Browse filesBrowse files
committed
Documented the console environment variables
1 parent 48cc9cd commit 7c4cd17
Copy full SHA for 7c4cd17

File tree

Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed

‎cookbook/configuration/environments.rst

Copy file name to clipboardExpand all lines: cookbook/configuration/environments.rst
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,37 @@ environment by using this code and changing the environment string.
212212
mode. You'll need to enable that in your front controller by calling
213213
:method:`Symfony\\Component\\Debug\\Debug::enable`.
214214

215+
Selecting the Environment for Console Commands
216+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217+
218+
By default, Symfony commands are executed in the ``dev`` environment and with the
219+
debug mode enabled. Use ``--env`` and ``-no-debug`` options to modify this behavior:
220+
221+
.. code-block:: bash
222+
223+
# 'dev' environment and debug enabled
224+
$ php app/console command_name
225+
226+
# 'prod' environment and debug enabled
227+
$ php app/console command_name --env=prod
228+
229+
# 'prod' environment and debug disabled
230+
$ php app/console command_name --env=prod --no-debug
231+
232+
In addition to ``--env`` and ``--debug`` options, Symfony commands behavior can
233+
also be controlled with environment variables. The Symfony console application
234+
checks the existence and value of these environment variables before executing
235+
any command:
236+
237+
* ``SYMFONY_ENV``, sets the execution environment of the command to the value of
238+
this variable.
239+
* ``SYMFONY_DEBUG``, if ``true``, debug mode is enabled for the command. If
240+
``false``, debug mode is disabled.
241+
242+
These environment variables are very useful for production servers, because they
243+
allow you to ensure that commands are always run on ``prod`` environment without
244+
having to add any command option.
245+
215246
.. index::
216247
single: Environments; Creating a new environment
217248

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.