-
-
Notifications
You must be signed in to change notification settings - Fork 649
Description
Hi!
I was working on a Laravel project that has a .env file.
But I faced an error that says:
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [APP_NAME].
After some time for debugging, I realized the problem is come from encoding of the file!
The encoding of the .env file is UTF8 BOM
In this example files you will see two files named .env-UTF-8
and .env-UTF-8-with-BOM
. They almost contains the same data, but .env-UTF-8-with-BOM
starts with the UTF8 BOM, causing the parse error.
How did happen?
I'm using linux as OS, but well it seems that when you add a text file in Visual Studio in windows, it adds the UTF8 BOM by default. I generated the second file that has to BOM using the Windows Explorer contextual menu "New File".