# Environment Variables for Laravel, Symfony & PHP Sites

> Edit the .env file of a Laravel, Symfony or PHP site from the FlyWP dashboard, and apply the change to the cache and queue workers.

Source: https://flywp.com/docs/site/php-apps/environment/

The **Environment** page lets you edit your application's `.env` file from the FlyWP dashboard, without SSH. Use it to set the keys your app needs, such as mail, payment, or API credentials.

## Edit the file

1. Open your site and click **Environment** in the site menu.
2. Edit the file in the editor. Each line is `NAME=value`.
3. Click **Update Environment**.

   ![Environment page of a Laravel site in FlyWP](https://flywp.com/wp-content/uploads/2026/11/php-apps-environment.png)

For a new site, you can also reach the editor with **Edit .env** on the **Ready to deploy** card. The editor loads the file from the server, so it shows a spinner for a moment.

## What is in a new `.env`

- **Laravel:** when the site is built, FlyWP writes `APP_NAME`, `APP_ENV` (`production`), `APP_DEBUG` (`false`), `APP_URL`, a generated `APP_KEY`, the `DB_*` database settings, and the `REDIS_*` settings.
- **Symfony and PHP:** the file starts empty.

On the first deployment, FlyWP adds any keys from your repository's `.env.example` that are missing from `.env`, without changing values that are already there. If your repository tracks its own `.env`, FlyWP keeps the site's `.env` file.

Before the first deployment, saving only stores the file. You see **Environment saved. The first deploy uses it.**

If FlyWP cannot read the file from the server, the page shows the error instead of the editor.

## Apply the change on Laravel sites

A Laravel app serves cached configuration, and queue workers read `.env` once when they start. Neither picks up a saved change on its own, so Laravel sites show these switches below the editor:

| Switch | What it does |
| --- | --- |
| **Config Cache** | Runs `php artisan config:cache` after the file is saved. On by default. |
| **Restart Queue Workers** | Restarts the queue workers, and Horizon if it is running, after the file is saved. Shown only when a queue worker or Horizon is running. On by default. |

Leave both on unless you have a reason not to. See [Queue workers](https://flywp.com/docs/site/php-apps/laravel-queue-workers/).

After you save, a message lists what ran, for example **Environment updated. Config cache rebuilt and queue workers restarted.** If a step fails, the message says what was saved and which step failed.

Symfony and PHP sites show the editor only, and FlyWP runs nothing after saving. If your app caches its configuration, clear that cache or deploy again.

:::caution
A wrong value in `.env` can break your application. Keep a copy of the current values before you make large changes.
:::

## Related guides

- [Laravel, Symfony & PHP Apps overview](https://flywp.com/docs/site/php-apps/)
- [Environment File Editor](https://flywp.com/docs/site/environment-file-editor/) (the general editor page)
