Closed Albvadi closed 3 years ago
Hey there,
Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.
Thanks!
I got this error too and I solved it by adding dotenv manually in bootstrap.php. I'm using Lumen ^9.0 and PHP 8.0.27
Description:
Sometimes, randomly, using
app()->environment()
I getlocal
instead ofdevelopment
(or the value configured in my .env file)Steps To Reproduce:
APP_ENV
in the .env fileI think is related tih PHP and multithread. There are some related reports like https://github.com/laravel/lumen-framework/issues/605, https://github.com/laravel/lumen-framework/issues/585, https://github.com/laravel/lumen/pull/132 In Laravel, I know it´s solved caching the config with
php artisan config:cache
but in Lumn this option doesn´t exist. Finally, @GrahamCampbell in https://github.com/laravel/lumen/pull/132#issuecomment-499140906 says it´s solved in his PRs, but I´m not sure it´s my fault...Also, reviewing phpdotenv upgrading guide there is a example code to make dotenv work properly. I have put that code before the
LoadEnvironmentVariables
inbootstrapp/app.php
and it seems to have solved my problem, but again I don't know if it is the correct way or if it should work without adding any additional code.Thank you.