Fix Laravel app not reading values from .env file

Stephen Akugbe - May 18 '22 - - Dev Community

I have been working on an application for a while now, and somehow one morning I noticed the application was no longer reading the Google recaptcha key from the .env file thus preventing me from gaining access to the system.
I thought I had tampered with my code somewhere, I looked back at the recent changes I made and none of them were related to the login aspect of the app.

Here is how I fixed it (I'm putting this out to help other developers as well as an easy access to my solution should I ever run into this kind of error again).

I initially ran the following commands but none of them fixed the issue.

php artisan optimize:clear
php artisan route:clear
Enter fullscreen mode Exit fullscreen mode

To fix the issue, I simply had to clear the configuration cache by running the following command:

php artisan config:clear
Enter fullscreen mode Exit fullscreen mode

and that was it, my application was reading the environment variables from the .env file.

If you found this article helpful, don't forget to leave a like.
Thanks for reading.

. . . . . . . . . . . . . . . . . . . . .
Terabox Video Player