開発したアプリなど一覧

"It is not safe to rely on the system's timezone settings." とか出てたので対処

アフィリエイトリンクを含む場合があります

ふと VPS で動いてる Apache のエラーログを見たらアホみたいに容量使ってたので確認したら以下のメッセージと共に大量のスタックトレースが出力されていた。

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 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /home/example/public_html/wp/wp-includes/functions.php on line 43

システムのタイムゾーンの設定に頼らずに date.timezone を設定するか date_default_timezone_set() 関数を使え、という事のようだ。運用している WordPress はいくつかあり、その一つ一つに関数を書き込むのは大変だるいので php.ini に変更を加えた。

$ sudo vi /etc/php.ini # コレ追加 date.timezone = "Asia/Tokyo"

その後 Apache を再起動したらエラーは消えた。

Sponsored Link

コメント

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