Skip to content

Commit

Permalink
feature #4665 Documented the console environment variables (javieregu…
Browse files Browse the repository at this point in the history
…iluz)

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
  • Loading branch information
weaverryan committed Dec 22, 2014
2 parents ceca63f + df2a0f2 commit c837ea1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cookbook/configuration/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,39 @@ environment by using this code and changing the environment string.
mode. You'll need to enable that in your front controller by calling
:method:`Symfony\\Component\\Debug\\Debug::enable`.

Selecting the Environment for Console Commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, Symfony commands are executed in the ``dev`` environment and with the
debug mode enabled. Use the ``--env`` and ``--no-debug`` options to modify this
behavior:

.. code-block:: bash
# 'dev' environment and debug enabled
$ php app/console command_name
# 'prod' environment (debug is always disabled for 'prod')
$ php app/console command_name --env=prod
# 'test' environment and debug disabled
$ php app/console command_name --env=test --no-debug
In addition to the ``--env`` and ``--debug`` options, the behavior of Symfony
commands can also be controlled with environment variables. The Symfony console
application checks the existence and value of these environment variables before
executing any command:

``SYMFONY_ENV``
Sets the execution environment of the command to the value of this variable
(``dev``, ``prod``, ``test``, etc.);
``SYMFONY_DEBUG``
If ``0``, debug mode is disabled. Otherwise, debug mode is enabled.

These environment variables are very useful for production servers because they
allow you to ensure that commands always run in the ``prod`` environment without
having to add any command option.

.. index::
single: Environments; Creating a new environment

Expand Down

0 comments on commit c837ea1

Please sign in to comment.