At the beginning of my configuration file I have:
date_default_timezone_set('America/Los_Angeles');
echo "Set default timezone: " . date_default_timezone_get() . "\n";
...
I execute PHP script via CLI and the output looks like this:
Set default timezone: America/Los_Angeles
PHP Warning: date(): 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 case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in
Why am I receiving the message "It is not safe to rely on the system's timezone settings" even after setting the timezone?
------ UPDATE ---------
Turns out this is a threading problem, so need to set to php.ini to solve it.
<?php
require __DIR__ . '/config.php';
date_default_timezone_set('America/Los_Angeles');
echo "Timezone: " . date_default_timezone_get() . "\n";
function threadTest() {
echo "Thread Timezone: " . date_default_timezone_get() . "\n";
}
$thread = new Thread_Async();
$thread->call('threadTest');
Results:
Timezone: America/Los_Angeles
PHP Warning: date_default_timezone_get(): 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 case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /pvolf/wwwdev/app/test.php on line 10
Thread Timezone: UTC