ゆずめも

メモ的なブログです。主に勉強した事について書いてます。

CakePHPのタイムゾーン設定

ちょっとcakephpを触ってて
ビルトインウェブサーバーでcakephp動かしたら

f:id:yuzu441:20140904144238p:plain

Warning: strtotime(): 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 /Users/yuzu/develop/projectx/cakephp-2.4.10/lib/Cake/Cache/CacheEngine.php on line 60

こんな感じでデフォルトのタイムゾーン設定してないよ!!って警告が

この警告の消し方を調べたのでメモ
\lib\Cake\Cacheディレクトリにある、CacheEngine.php
f:id:yuzu441:20140904154343p:plain
こんな感じで59行目辺りに

data_default_timezone_set('Asia/Tokyo');

を追加すると、タイムゾーンが東京に設定され警告が消えます!