php.ini に timezone をセット

ローカル環境での php開発環境を作っていく中で、実際に php を動かしたら、こんなエラーが出た。

It is not safe to rely on the system's timezone settings.
Please use the date.timezone setting, the TZ environment variable 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 '9.0/no DST' instead


確認したところ、php.ini に timezone の設定が抜けていた。
(XAMPPlite だと、xampp\apache\bin\php.ini になる。xampp\php\php.ini で無いことに注意)

php.ini に以下の設定を追加

[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Tokyo


ちなみに初期状態だと date.timezone がコメントアウトされていました。



同じカテゴリー(PHP)の記事

上の画像に書かれている文字を入力して下さい
 
<ご注意>
書き込まれた内容は公開され、ブログの持ち主だけが削除できます。

写真一覧をみる

削除
php.ini に timezone をセット
    コメント(0)