スケルトン・エピ

letsspeakのブログです。

phpのstrftime()で警告が出る件とoil create fuelphpの失敗

前回の記事で

$ php -a
Interactive shell

php > echo strftime('%Y-%m-%d %H:%M:%S', time());
2013-03-09 13:40:52

を実行すると

PHP 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 php shell code on line 1

というエラーが出る件で「宿題(キリッ」なんて言ってましたが、/etc/php.ini の date.timezone が指定されていない事が原因でした。

/etc/php.ini
date.timezone = "Asia/Tokyo"

日本標準時なら上記設定でOK。

ちなみに date.timezone が正しく設定されていない場合、oil create fuelphp も下記エラーで失敗します。

Submodule path 'fuel/packages/parser': checked out '593d93d0e4baf551ea14f59d8ecbba4ba6f28dea'
Entering 'docs'
Entering 'fuel/core'
Entering 'fuel/packages/auth'
Entering 'fuel/packages/email'
Entering 'fuel/packages/log'
Entering 'fuel/packages/oil'
Entering 'fuel/packages/orm'
Entering 'fuel/packages/parser'
PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

ググってみたところ、こちらの素敵なブログに事例が書いてあって解決しました。
この場を借りて御礼申し上げます!

いやーとてつもなくダサいッ!