当前位置: 首页 > 面试题库 >

“ date():依靠系统的时区设置是不安全的……”

孔逸春
2023-03-14
问题内容

当我请求将服务器上的PHP版本从5.2.17 更新到PHP 5.3.21
时,出现此错误。

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  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 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 86</p>

</div>
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 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 86

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 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 99
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  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 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 99</p>

</div>

问题答案:

您可能需要将时区放在php.ini文件的配置行中。您应该在php.ini文件中有一个这样的块:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

如果没有,请添加它(用您的时区代替)。配置后,请确保重新启动httpd(service httpd restart)。

这是受支持的时区列表。



 类似资料:
  • 问题内容: 我有一个Symfony2项目。我今天将php更新到5.5.7,从那时起,我开始 我在php.ini中设置了默认时区 为了确保这是很好的php.ini,我正在与 我要到达的路径就是我正在修改的路径: 但是在那里,我看到了 真奇怪 任何的想法?谢谢。 问题答案: 也许您正在尝试在Apache的中进行设置,但您的CLI(命令行界面)不好。 使用以下命令查找文件: 然后搜索并将其设置为。所有有

  • 取消PPA仓库 当添加太多的 PPA 仓库之后,apt update 的速度就会慢很多。 考虑到大多数软件不会经常更新,而且我们也没有立即更新的迫切需求,因此建议取消这些 PPA 仓库。 具体做法,”开始菜单” -> “系统管理” -> “软件源” -> “PPA”, 将不需要及时更新的软件的 PPA 取消: 这个操作可以在每次你觉得 apt-get update 速度慢时检查 :)

  • Slitaz提供许多关于系统安全的信息。软件在进入稳定发行版之前会经过几个月的测试。在启动的时候,服务会由rc脚本运行。要想知道开机自启动的服务列表,你可以查阅/etc/rcS.conf中的RUN_DAEMONS变量: $ cat /etc/rcS.conf | grep RUN_DAEMONS 要显示当前进程及其PID、内存使用,你可以使用ps命令或者htop程序(需安装): $ ps $ ht

  • 一、简介 PHPSSO可以设置禁止注册的用户名或EMAIL等。还可以整合ucenter,实现v9与uc的用户整合,实现与uc应用的同步注册、登录。还可以设置与php2008 sp4密码兼容等。 二、功能演示 1,注册配置 设置禁止注册用户名,E-MAIL等。如下图所示: 2,UCenter配置 配置好基本信息就能实现v9与uc的用户整合,实现与uc应用的同步注册、登录。如下图所示: 1,PHP20

  • Chapter 10. 系统安全 Table of Contents 10.1. 安全等级 10.2. 安全策略 10.3. 安全工具 系统安全是应用的基础,一个安全的系统才能长时间不间断运行,有效支持我们的应用。建立一个安全的系统需要一个好的软硬件平台,但更重要的是要有一个优秀的系统管理员能及时地发现安全问题和解决安全问题。 如何评价一个系统的安全程度,美国国家计算机安全中心(NCSC)制定了可

  • 问题内容: 可以安全地假设函数参数在Python中是从左到右求值的吗? 参考文献指出,这种情况会发生,但是也许有某种方法可以更改此顺序,这可能会破坏我的代码。 我想做的是为函数调用添加时间戳: 我知道我可以按顺序评估参数: 但是它看起来不太优雅,因此如果可以依靠它,我宁愿采用第一种方法。 问题答案: 是的,Python始终从左到右评估函数参数。 据我所知,这适用于任何逗号分隔的列表: