Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fico7489's avatar

Problem with ".env" file

I have different database name in .env file and in config/database.php Laravel framework should connect to database name in .env file and it works ok, but every 20,30 request framework gets database name from config/database.php and error is throw. Why is this hapening ????

0 likes
2 replies
bashy's avatar

It always get the info from that file? .env just sets the getenv() part. Do you mean it's using the default value?

2 in this case?

($var ? 1 : 2)
shihabudheen's avatar

I had the same issue,recently I got updates from Laravel, now issue not existing, It doesn't throw any 500 exception when sending simultaneously multiple requests.
Also used following comments,
php artisan route:cache
php artisan config:cache
php artisan optimize

Please or to participate in this conversation.