大家好,请教一个问题系统是2003,安装有framework2.0,fastcgi,iis6.0,php5.4.4配置php5.4.4后,使用iProber探针,除服务器时间外,都显示正常。服务器时间显示: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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\wwwroot\iProber.php on line 231
2012年7月9日 07:42:02  北京时间: 2012年7月9日 15:42:02重新配置php.ini,改为date.timezone = Asia/Shanghai和date.timezone = PRC,均无效(已经去掉了前面的;),探针服务器时间问题依旧。服务器时区和时间是正常的,参考http://topic.csdn.net/u/20100708/21/a6086a64-6ce5-4f53-9251-cb9365bf0eb1.html 帖子,CunningBoy兄说的“TZ应该是phpinfo()列出的date部分的Default timezone”没有找到位置。烦请朋友们帮忙看看,多谢!

解决方案 »

  1.   

    补充,以上修改后,均重启了IIS,但问题依旧。
      

  2.   

    在文件裏設置時區看看
    date_default_timezone_set()
      

  3.   

    请问是把以上的date_default_timezone_set(‘PRC’)信息,直接放在php.ini中date.timezone =后面的位置吗?
      

  4.   

    刚才测试了,还是不行。我注意到探针给的错误提示是,要我修改探针的php文件,将其中的timezone设置成我自己服务器的时区,难道真的需要去修改探针的文件吗?
      

  5.   

    不是 date_default_timezone_set(‘PRC’)是date_default_timezone_set('PRC')先确认一下.另外 你的除服务器时间外的服务器时间是echo date('Y-m-d H:i:s');的时间不正常吗?
      

  6.   


    多谢指导,我把date_default_timezone_set('PRC'),直接替换了php.ini中的date.timezone = PRC,但探针的服务器时间仍报错误。
    -----------------
    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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\wwwroot\iProber.php on line 231
    2012年7月9日 08:40:12  北京时间: 2012年7月9日 16:40:12
    ---------------
    上面的iProber.php,是我探针的php访问页面。另外你说的“echo date('Y-m-d H:i:s');”,所表现出来的是不是就是上面显示的“2012年7月9日 08:40:12  北京时间: 2012年7月9日 16:40:12”?除了前后两个时间相差8小时外,应该没问题吧。是不是程序在调用我php.ini之前,优先调用了其他的timezone,导致后续php.ini正确设置失效,但我找不到之前调用的内容在哪里,可以推断调用的是UTC的时间。
      

  7.   

    你上面的括号是否是全角下的括号,我无法分辨,因为我直接复制了你的代码改了里面的单引号,如果是的话 你自己再修改一下吧date_default_timezone_set('PRC')另外 echo phpinfo();就可以看到使用的php.ini文件具体是哪个了,修改那个然后重启apache 基本上应该就正常了.最后一点确保你服务器的系统时间是正确的,不要系统时间都是不正确的,那就搞笑了.
      

  8.   

    在探针的页面中,我看到了phpinfo的连接,进入后直接到达:http://.../iProber.php?act=phpinfo,的页面,其中发现date中的警告与上面略有不同:date
     Warning: phpinfo(): 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 C:\inetpub\wwwroot\iProber.php on line 58
     
    date/time support:enabled  
    "Olson" Timezone Database Version : 2012.3  
    Timezone Database : internal 
    Default timezone : UTC这里已经明确的看到Default timezone是 UTC了,但是无法修改。  
      

  9.   

    恩,我确认了一下,肯定是英文输入下的单引号和括号。另外,您说的echo phpinfo()命令是linux的命令吧?在windows下,应该如何使用?我还没装apache,这个有影响吗?服务器的系统时间和时区,肯定是中国的,我检查了。
    麻烦了,请多费心,谢谢
      

  10.   

    <?phpecho phpinfo();
    ?>这是php页面代码 保存成一个文件 然后在浏览器里打开这个网址看看.比如服务器上 localhost/index.php不需要apache 因为你已经可以看探针那就说明你的环境应该已经正常了
      

  11.   

    多谢PhpNewnew的帮助,在我热力测试的时候又发现了新的问题,先把这贴结了~