export
What is export?
export: Export — Set an environment variable so child processes inherit it. export makes a shell variable available to programs started from that shell. export APP_ENV=testing sets the variable for the current session and every command you run afterwards. Without export, a variable exists only in the shell itself. A PHP or Node process you start will not see it.
Frequently asked questions about export
What should you keep in mind with export?
Variables set this way disappear when you close the terminal. To keep them, add the line to your shell profile, such as ~/.bashrc or ~/.zshrc. For project settings, a .env file read by the application is usually the better choice, because it lives with the project instead of your personal shell. Avoid exporting secrets in your profile, where every program you run can read them.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |