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.
Edit
I am aware of using config for setting the timezone but in this particular instance I must use the .env file as we have a dev-ops team in charge of which servers we point to + we need a support failover that doesn't require a developer's intervention just to point to another server. So I need to know why Laravel seems to have an issue with loading .env "in-time" instead of work-arounds.