Check APP_ENV
in your .env
file, if it’s value is correct (production
in OP’s case) then yes, Laravel is caching it.
Once cached, the .env
file is ignored, and env(...)
function returns null
.
You should run these commands after changing configs:
php artisan cache:clear
php artisan config:cache
php artisan route:cache
php artisan optimize
Note that “
php artisan config:cache
” may be enough, but changingAPP_ENV
could add or remove routes or something like that (is your App, you know better).