[PHP] strftime(), timezoneに関するエラーが出た時の対処法

PHP

PHPのグラフ生成ライブラリJpGraphをこちらのチュートリアル記事を見ながら、サーバにインストールしました。そして、Examplesのファイルを使った最初の動作確認でエラー発生。以下のようなコードを吐きました。

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 the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /home/xxx/www/xxx/includes/jpgraph/jpgraph.php on line 390

timezoneの設定をしてやれば良いようです。php.iniに以下のコードを書き足します。

date.timezone = Asia/Tokyo

再び実行してみると、今度は正しく表示されました。

広告