Fix : env() always returns blank values in Laravel

So I move my application to hosting server and things don’t run as expected. Look’s like my fetching my environment variables from .env file via env() function always return blank.

While scratching my head and trying out different things. Here is the command steps that finally worked.

php artisan config:clear 
php artisan optimize
php artisan config:cache

This make sures you clear your configuration cache and then put new values in cache to be used.

Might help someone in similar situation. OK Thanks !

Leave a reply:

Your email address will not be published.

Site Footer