PHP実行時のタイムゾーンのエラー

投稿者: | 2016年6月6日

PHPのスクリプトを実行した際に下記のような警告が発生し、実行が中断されました。

PHP 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 'Asia/Tokyo' for 'JST/9.0/no DST' instead
 in /opt/aws/php/vendor/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/InstanceMetadataClient.php on line 99

原因はデフォルトのタイムゾーンが設定されていないためです。
対策は「/etc/php.ini」に対して下記のように修正し、タイムゾーンの設定を行なうだけです。

date.timezone = Asia/Tokyo

「data.timezone」は元々コメント行となっているため中身を検索すれば記述が見つかります。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA