「Warning: strftime(): It is not safe to rely on the system’s timezone settings….」ってでる。

PHP

Smartyを使っていたら以下のようなエラーがでた。。。

「Warning: strftime(): 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 ‘Asia/Tokyo’ for ‘JST/9.0/no DST’ instead in /usr/local/lib/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 169 」

どうやら、システムのタイムゾーンが設定されてないぞ!date_default_timezone_set()とかを使って設定しといたほうがいいよ。
とりあえず、’Asia/Tokyo’を設定しといたぞ。と言っているみたい。

ということで、以下の一文をスクリプトの最初に入れておけばOKです。

php.iniで設定する場合は、”date.timezone”に設定します。

/

タイトルとURLをコピーしました