PHP5.4をインストールして早速確認しようとphp -i したらなんかWarningが出ました。↓こんなの。
PHP Warning: Unknown: 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 the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in Unknown on line 0
タイムゾーンの設定をしないとUTCになるよってことらしいです。
広告
php.iniでタイムゾーンの設定をする
共有サーバーなんかでこんなエラーが出た場合はini_setやdate_default_timezone_set()なんかで設定するしかありませんが、今回は自分のサーバーなので、php.iniで設定しちゃいます。
1 2 3 4 |
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ;date.timezone = |
↑これを
1 2 3 4 |
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Tokyo |
こんな感じに
これでWarningが表示されなくなりました。