I am confused about .env file as when I hosted the laravel application the .env file is missing on the web server. If anybody knows the way how can we find .env file on the server please answer.
-
you need to create a new one inside on your server. but if you want to include your env then remove it from gitignore list so it will include to upload it to your repo then server – Winston Fale May 01 '18 at 06:32
-
I have removed .env file from gitignore even then the .env file is missing on the server – May 01 '18 at 06:34
-
i think you need to make .env for server using touch command then edit it via vim command https://stackoverflow.com/questions/9381463/how-to-create-a-file-in-linux-from-terminal-window . env should be created manually inside in the server so it will seperate your local and server. – Winston Fale May 01 '18 at 06:38
4 Answers
Try ls -la
to list all files in your web root.
As other have said, it sounds like the file exists but you cannot see it because it is a hidden file (denoted by the .
in .env
)
For future reference, whilst .env
is likely to be excluded in a .gitignore
there is often a .env.example
which is include that you can copy and modify for your environment.

- 3,724
- 1
- 18
- 29
By default a Laravel app's Git repo will ignore the .env
file - it's because you will use this on your development machine to configure the app to work on that environment.
You should have another .env
file on your server which provides the configuration required for your app to run in that environment. This file should be maintained between deployments - and most importantly, the credentials inside of it should not be tracked in a repo.

- 12,120
- 6
- 51
- 64
-
when I am trying to create .env file then server says file already exist but I am unable to find .env file – May 01 '18 at 07:07
-
Where are you trying to create it? Keep in mind that `.env` is a hidden file so it's generally not going to show up in any sort of UI unless you explicitly show hidden files. – Dwight May 01 '18 at 07:08
-
-
i have do `git init` `git add .` and `git commit -m ""` after that my env gone. but still connected to mysql. if i change db name, its not working. where to edit my dbname seems gone on my mac directory. – Dicky Raambo Sep 13 '18 at 03:39
Your .env file is there! It is a hidden file and you can't see it with gui unless if you somehow reveal hidden files! I recommend you to use putty over windows or ssh over linux terminal and edit it if you know how to do that.

- 14,256
- 18
- 107
- 148
By default some files like .env, .htaccess are hidden on the server therefore to see these files we need to set as show hidden files on the server settings.