Question

The environment file is invalid: Dotenv values containing spaces must be surrounded by quotes

Posted December 9, 2019 2.6k views
Applications

Hello everyone I need help regarding this error message: “The environment file is invalid: Dotenv values containing spaces must be surrounded by quotes”

I just finished setting up environment for my app according to the request of the wizard installer of the app. I input things like database credentials, mail credentials, google client ID and others. After that, upon visiting my website, I found this error. That made me to remember that when I was filling the forms, I spaced out my username when entering the mail credentials, so I don’t know if that is part of my problem now.

So, how do I access the Dotenv file according to the error instruction to check the files with spaces and correct them? OR
Which command will I use to get rid of this once and for all?

In fact, how do I solve this problem?

Thanks, everyone. looking forward to hearing from you.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

Would you mind confirming which application exactly did you deploy? I can then confirm the exact location of the Dotenv file and the exact steps that you need to take to fix it.

But for example if you are using Laravel the default location of the .env file is at:

/var/www/html/.env

You need to open this file with your favorite text editor and find the username line:

nano /var/www/html/.env

Find the user name variable and add quotes around the value.

Regards,
Bobby

  • Thanks @bobbyiliev for your wonderful support.
    I was able to solve it, unfortunately the answer came late. This is what I did;

    First of all. the app I deployed is the Laravel app.

    You know, what happened was that there is one mail platform that I have an account with, in that platform my username was spaced out and it was that username that I used when entering my mail credentials on.env. So, I went back to that mail platform and changed my username so that it will not have space again.

    Now. I went to Filezilla, locate the .env, edit it on Filezilla, and change that username to the current one, save the file, then upload it back to the server. Now, the app is up and running.

    But, one thing is what I am facing now, I can’t log in to the app admin panel, even after entering the default login credentials. What do I do now?

    • Hi @IGLIGHT,

      No problem at all! I’m happy to hear that you’ve got the first part sorted out!

      What I could suggest is first checking your Laravel log for some more information regarding the error that could be occurring, the log should be at:

      /var/www/html/storage/logs/laravel-DATESTAMP.log
      

      Change the path accordingly so that it matches the one that you are using.

      Also are there any errors displayed when you try to login or does it just refresh back to the login screen?

      Regards,
      Bobby

Submit an Answer