Change your Laravel .ENV file configuration through the control panel

Austin Beresford
Published: 21 February 2023
Share:

The Laravel .env file is a configuration file that contains environmental variables for your Laravel application. These variables are used to store sensitive data such as database credentials, API keys, and other important configuration settings that your application needs to run properly.

The .env file is located in the root directory of your Laravel project and is loaded automatically by Laravel when the application boots up. This file contains a list of key-value pairs, where the keys are the names of the environmental variables, and the values are their corresponding values.

Using the ENV Configuration Tool

If you've deployed a Laravel-optimised Managed Cloud Server then you can quickly and easily add or change existing Laravel environment variables using the ENV Configuration tool within the 20i control panel.

To use the ENV Configuration tool:

  • Head to your Hosting Packages and select Options > Manage on the package you need to manage
  • Select ENV Configuration from the Laravel Tools section

If you've just deployed a new application then you'll see all the default environment variables pre-populated in the table view. If you want to adjust any variables, for example 'APP_DEBUG', then you can simply edit the right-hand side column with the option you want and the proceed to select Update ENV Configuration to save your changes.

If you want to edit the ENV file directly through File Manager, then there's a quick link to take you directly to the file at the top-right of the page, select View in File Manager to go directly to the source file which is usully found within your applications home directory.

You can also add new variables to your file by inputting the variable you want to add in the text field at the bottom-left of the table, then inputting the variable in the text field to the right. Then Update ENV Configuration will add the new variable to the table/file.