apacheのエラーログにtimezone関連のエラーが吐かれている場合の解決方法を紹介します。
[Thu Apr 09 05:41:05 2015] [error] [client ****.****.****.****] PHP Warning: date(): 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 /var/www/html/hoge/fuga.php on line 284
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
と怒られている。
●timezone.settingとあるので、php.iniを確認
# php -i | grep timezone PHP Deprecated: Comments starting with '#' are deprecated in /etc/php.ini on line 878 in Unknown on line 0 Default timezone => Asia/Tokyo date.timezone => no value => no value ←設定されていない! ** php -i はphpinfo相当のキャラクタ情報で便利です。
vi /etc/php.ini ・ ・ [Date] ; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone date.timezone = "Asia/Tokyo" ←"Asia/Tokyo" 追加
●構文チェック
# apachectl configtest Syntax OK
apache再起動後、エラーログは解消されます。
以上です。