.env file wont load variables into config.php - student setting up first php dev environment

前端 未结 2 1849
栀梦
栀梦 2021-01-27 02:42

Afternoon everyone,

I\'m a student studying Computer Science and I\'m trying to recreate the environment my friend is using to host their PHP based web app. They\'re on a

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 03:22

    I'm using WSL and am similarly having problems with my .env not working properly.

    Although I'm still looking for a more elegant fix, the hack I'm relying on now is:

    1. Copy the contents of your .env to a temporary text file.
    2. In that text file, do a regex find-and-replace searching for "\n" and replacing with "\nexport " (with a trailing space).
    3. Move the final line's "export " to the first line.
    4. Copy the contents of this temporary text file.
    5. Paste into your terminal to run these commands.
    6. Now you should be able to run your app.

提交回复
热议问题