Skip to content
Discussion options

You must be logged in to vote

This is expected behavior: once you run php artisan config:cache, Laravel compiles all configuration files (including .env values) into a single cached file (bootstrap/cache/config.php). After that, Laravel no longer reads .env directly.

So when you change .env, those changes won’t apply until you clear and rebuild the cache.

Solution:

  1. Clear the config cache:

    php artisan config:clear

    This deletes the cached config file.

  2. Rebuild the cache:

    php artisan config:cache

    This regenerates the cache with your updated .env values.

  3. Best practices:

    • Always run php artisan config:clear after changing .env in production.
    • If you’re debugging locally, avoid caching configs until you’re done.
    • In CI/C…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@clarkeex
Comment options

Answer selected by clarkeex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants