PHPでgetdate()やstrtotime()を使うとWarning: strtotime() [function.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 /Library/WebServer/Documents/hijuke1.php on line 21と出てきます。

timezoneを Asia/Tokyo から JST/9.0/no DSTに変えてみたけどだめでした。
どうすればいいのか誰か教えてください。

回答の条件
  • URL必須
  • 1人5回まで
  • 登録:
  • 終了:2011/06/20 09:55:03

回答2件)

id:JULY No.1

回答回数966ベストアンサー獲得回数247

PHP: date_default_timezone_set - Manual

getdate() や strtotime() を呼び出す前に date_default_timezone_set() で "Asia/Tokyo" もしくは "Japan" を設定するか、php.ini の date.timezone で同様の設定をする。

...が基本ですが、それ以外の原因はちょっと思いつきません....

id:tomoxyz1220

ありがとうございました。

2011/06/13 17:56:59
id:windofjuly No.2

回答回数2625ベストアンサー獲得回数1149

過去質問からMacでMAMPだとして回答してみます

 

Macに用意されているphpとMAMPのphpのどっちを使っているかによってタイムゾーンを設定すべきphp.iniの在り処が違います

デフォルト /usr/bin/php.ini

MAMP /Applications/MAMP/conf/php5/php.ini

 

とりあえず使えればいいということならdate-default-timezone-set関数で一時的にタイムゾーンを替えてしまうという手もあります

http://php.net/manual/ja/function.date-default-timezone-set.php

id:tomoxyz1220

ありがとうございました。

2011/06/13 17:57:24

コメントはまだありません

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません