mercredi 4 mai 2016

Laravel 5.2 .env sometimes doesn't load in time

I'm reading some configurables from my .env file. These configurables are used in various places within the project. A few times i've received an exception that one of the env variables does not exist. Example:

ini_set(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function.

In my .env I have this:

TIMEZONE=Africa/Johannesburg

In the boot function of my AppServiceProvider I have:

ini_set('date.timezone', getenv('TIMEZONE'));

It's as if the .env hasn't loaded at the time im trying to use one of its variables? Ive seen this happen for a few different .env variables at various stages during the application running.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1X83DSP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire