【问题标题】:php Warning: strtotime() Errorphp 警告:strtotime() 错误
【发布时间】:2013-02-05 09:20:38
【问题描述】:

我已将我的 joomla 和 wordpress 文件从旧服务器更改为新服务器。在前端和管理方面它的工作没有任何错误。但是在数据库(phpmyadmin)部分它显示了一些像这样的警告消息..

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/Calcutta' for 'IST/5.0/no DST' instead in /usr/share/phpmyadmin/libraries/db_info.inc.php on line 88

Warning: strftime() [function.strftime]: 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/Calcutta' for 'IST/5.0/no DST' instead in /usr/share/phpmyadmin/libraries/common.lib.php on line 1483

您能否建议,如何隐藏这些警告消息??

提前致谢。

【问题讨论】:

  • 注意: php-cliphp.ini 文件与 apache2php.ini 文件不同。我建议将一个符号链接到另一个以使它们保持同步并避免混淆!

标签: php string wordpress joomla phpmyadmin


【解决方案1】:

您真的只是想隐藏错误消息还是想解决问题,他们表示?

在您的新服务器上,您应该在php.ini 文件中找到一个设置date.timezone 被注释掉。在这里,您必须指定您的服务器所在的时区。例如,我的服务器位于德国,所以我在这里使用Europe/Berlin

date.timezone = Europe/Berlin

您可以在此处找到支持的时区的完整列表:

http://www.php.net/manual/en/timezones.php

更改此设置后,重新启动您的网络服务器,警告应该会消失。

【讨论】:

    【解决方案2】:

    看看如何使用error_reporting,http://php.net/manual/en/function.error-reporting.php

    【讨论】:

      【解决方案3】:

      最好的方法是设置默认时区。 在 config.inc.php 文件中,插入一行:

      date_default_timezone_set('America/Sao_Paulo');
      

      在我的情况下,我使用“America/Sao_Paulo”,在你的情况下我认为是“Asia/Calcutta”

      有关时区的更多详细信息,请访问http://php.net/manual/en/function.date-default-timezone-set.php

      【讨论】:

        【解决方案4】:
        date_default_timezone_set('Europe/London'); 
        

        试试这个 PHP 代码可能会解决你的问题...

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-11-29
          • 1970-01-01
          • 2012-12-18
          • 1970-01-01
          • 1970-01-01
          • 2011-02-01
          • 2018-05-06
          相关资源
          最近更新 更多