recently a server was upgraded to fc14 with php v538 and when runnning php based website, i get the following warning:
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 'Australia/Melbourne' for ......
there are 2 ways to fix it.
in every startup php script
in the beginning of the script, add the following code:
PHP:
date_default_timezone_set("your time zone"); |
look for supported timezone here.
the downside with this method is, you must remember to add this code in every startup script.
in /etc/php.ini
the timezone setting is commented out:
Code:
[Date] | |
; Defines the default timezone used by the date functions | |
;date.timezone = "" |
look for this setup, uncomment line 3 and enter your timezone string. remember to restart or reload apache.
you can forget about setting timezone from now on.
however, if you do not have access to this file, you will have to use the first method.
Leave a comment