Home > Software design >  Laravel 8 config:cache allowing sending emails but can't read env variables after config:cache
Laravel 8 config:cache allowing sending emails but can't read env variables after config:cache

Time:02-24

hope you are all fine. I am facing an issue when I am running command

php artisan config:cache

email is sending but I can't read env('DB_HOST') variables.

Similarly when I run then this time:

php artisan config:clear

email is not sending, now I can read env('DB_HOST') variables.

I don't understand what is issue.

CodePudding user response:

Read this https://laravel.com/docs/8.x/configuration#configuration-caching

You must be use correspond config. IN your case

config('database.connections.mysql.host')
  • Related