Bird
0
0

You set the cache driver to 'redis' in .env but Laravel still uses the file cache. What is the most likely cause?

medium📝 Debug Q14 of 15
Laravel - Configuration and Environment
You set the cache driver to 'redis' in .env but Laravel still uses the file cache. What is the most likely cause?
AYou forgot to clear the config cache with <code>php artisan config:clear</code>
BRedis is not installed on your system
CThe 'file' driver is always used by default
DYou need to restart the web server
Step-by-Step Solution
Solution:
  1. Step 1: Understand Laravel config caching

    Laravel caches config files for performance, so changes in .env may not apply immediately.
  2. Step 2: Identify how to apply .env changes

    Running php artisan config:clear clears cached config, allowing new .env values to take effect.
  3. Final Answer:

    You forgot to clear the config cache with php artisan config:clear -> Option A
  4. Quick Check:

    Clear config cache to apply .env changes [OK]
Quick Trick: Clear config cache after .env changes [OK]
Common Mistakes:
  • Assuming Redis must be installed locally for Laravel to use it
  • Thinking file driver is always default
  • Restarting server without clearing config cache

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes