'Lumen on AWS Elastic Beanstalk - .env

I'm trying to deploy a Lumen app in Elastic Beanstalk. The problem is around the .env file, of course it's gitignored, so how can I put that file into the server?

I tried to manually create the file after deploying, but the next deploy the file disappear and I have to manually recreate that file again. I don't think this is a solution....

What's the correct the way?

I tried with this solution but looks like the env variable are not being created after the deploy, so, is the only way to add directly to the AWS console?

Update

I manually added env variables through the AWS console, those variables are being displayed if I "echo" them (eg. echo $APP_ENV gives me the correct value production) but still those env variables are not being loaded in the Lumen app and ignored. Any thoughts?



Solution 1:[1]

Updating vlucas/phpdotenv from 1.0 to 2.2 solved the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 peppeocchi