Solution To: "Warning: date() [function.date]: It is not safe to rely on the system's timezone settings" (PHP)


Error (PHP):

Warning: 
date() [function.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. 

Solution:

1. Edit PHP.ini, uncomment the date time
e.g.
date.timezone = Asia/Kuala_Lumpur


2. Edit PHP script, add the date time statement
if( ! ini_get('date.timezone') )
{
    date_default_timezone_set('Asia/Kuala_Lumpur');
}

Further References:
http://php.net/manual/en/datetime.configuration.php#ini.date.timezone
http://php.net/manual/en/book.datetime.php

Post a Comment

0 Comments