2011/8/13 PHP

PHPの設定がデフォルトのままの場合、日付関係の関数(date()とか)を使うとwarningを出してきます ↓エラー文

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 /xxx.php on line xxx


  1. php.iniを開く
sudo vi /etc/php.ini
  1. [Date]の部分を探し、次のように修正する
[Date] ; Defines the de...... ; http://www.php...... date.timezone = Asia/Tokyo 
  1. apacheの再起動
sudo /etc/init.d/httpd restart