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 c837ea1

Browse filesBrowse files
committed
feature #4665 Documented the console environment variables (javiereguiluz)
This PR was merged into the 2.3 branch. Discussion ---------- Documented the console environment variables | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | #4162 Commits ------- df2a0f2 Fixes and tweaks dd8157f More tweaks and grammar fixes 2fb082d Rewordings and transformed a list into a definition list a1d88d8 More grammar fixes 8ead4a4 Minor grammar fix 6fc8f4c Fixed some errors in the explanation 7c4cd17 Documented the console environment variables
2 parents ceca63f + df2a0f2 commit c837ea1
Copy full SHA for c837ea1

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+33
-0
lines changed

‎cookbook/configuration/environments.rst

Copy file name to clipboardExpand all lines: cookbook/configuration/environments.rst
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,39 @@ 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 the ``--env`` and ``--no-debug`` options to modify this
220+
behavior:
221+
222+
.. code-block:: bash
223+
224+
# 'dev' environment and debug enabled
225+
$ php app/console command_name
226+
227+
# 'prod' environment (debug is always disabled for 'prod')
228+
$ php app/console command_name --env=prod
229+
230+
# 'test' environment and debug disabled
231+
$ php app/console command_name --env=test --no-debug
232+
233+
In addition to the ``--env`` and ``--debug`` options, the behavior of Symfony
234+
commands can also be controlled with environment variables. The Symfony console
235+
application checks the existence and value of these environment variables before
236+
executing any command:
237+
238+
``SYMFONY_ENV``
239+
Sets the execution environment of the command to the value of this variable
240+
(``dev``, ``prod``, ``test``, etc.);
241+
``SYMFONY_DEBUG``
242+
If ``0``, debug mode is disabled. Otherwise, debug mode is enabled.
243+
244+
These environment variables are very useful for production servers because they
245+
allow you to ensure that commands always run in the ``prod`` environment without
246+
having to add any command option.
247+
215248
.. index::
216249
single: Environments; Creating a new environment
217250

0 commit comments

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