-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
8000
Clarifying that .env can be used on production #10548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Clarifying that .env can be used on production
- Loading branch information
commit bc5ad90f54c62fb03b98baac561b61f4eb11c760
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,16 +125,27 @@ B) Configure your Environment Variables | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Most Symfony applications read their configuration from environment variables. | ||
While developing locally, you'll usually store these in a ``.env`` file. But on | ||
production, instead of creating this file, you should set *real* environment variables. | ||
While developing locally, you'll usually store these in a ``.env`` file. On production, | ||
you have two options: | ||
|
||
How you set environment variables, depends on your setup: they can be set at the | ||
command line, in your Nginx configuration, or via other methods provided by your | ||
hosting service. | ||
1. Create "real" environment variables. How you set environment variables, depends | ||
on your setup: they can be set at the command line, in your Nginx configuration, | ||
or via other methods provided by your hosting service. | ||
|
||
At the very least you need to define the ``APP_ENV=prod`` environment variable | ||
to run the application in ``prod`` mode, but depending on your application you | ||
may need to define other env vars too. | ||
2. Or, create a ``.env`` file just like your local development (see note below) | ||
|
||
There is no significant advantage to either of the two options: use whatever is | ||
most natural in your hosting environment. | ||
|
||
.. note:: | ||
|
||
If you use the ``.env`` file on production, you may need to move your | ||
``symfony/dotenv`` dependency from ``require-dev`` to ``require`` in ``composer.json``: | ||
|
||
.. code-block:: terminal | ||
|
||
$ composer remove symfony/dotenv | ||
$ composer reuire symfony/dotenv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (typo on "require" fixed in d45f041) |
||
|
||
C) Install/Update your Vendors | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have problems on this first command:
--dev
, i.e.:composer remove --dev symfony/dotenv
--dev
), it causes an error from the Symfony console:composer require symfony/dotenv
alone also removes the package fromrequire-dev
(which is closer to a "move" than remove-then-reinstall).So what about simply removing this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #11112