为什么我的 PHP 错误日志滞后 2 小时?

发布于 2024-09-07 14:37:45 字数 361 浏览 1 评论 0原文

当从命令行上的 phpinfo 和 php -i 检查 php.ini 时,我的时区设置为 Africa/Johannesburg。所以我的时区是 GMT +2。

我编写了一个小片段来检查时间是否正确,如下所示:

echo date('h:i A', time());
echo '<br />' . ini_get('date.timezone');

这会输出正确的时间,与我本地计算机的系统时间相匹配。

但是,当我查看我的 php 错误日志时,每个错误日志项的时间正好落后两个小时?这是为什么,我该如何解决这个问题。

Zend Cache 也有问题,我认为这次是问题造成的。

When checking php.ini, from both phpinfo and php -i on the command line, my timezone is set to Africa/Johannesburg. So my timezone is GMT +2.

I wrote a tiny snippet to check the time is right as follows:

echo date('h:i A', time());
echo '<br />' . ini_get('date.timezone');

and this outputs the correct time, matching with my localmachine's system time.

However, when I look at my php error log, the time on each error log item is behind by exactly two hours? Why is this, and how can I fix this.

Also having issues with Zend Cache, and i think this time issue is causing it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

自由范儿 2024-09-14 14:37:45

听起来 PHP 配置了一个时区,而运行它的服务器设置为不同的时区(可能是 GMT / UTC)。这意味着所有文件操作等都将在与 PHP 脚本不同的时区进行。

检查服务器的系统时区。

It sounds like PHP is configure with one timezone, and the server it is running on is set to a different time zone (possibly GMT / UTC). This means all file operations etc will be working on a different timezone to your PHP scripts.

Check the system timezone of your server.

短叹 2024-09-14 14:37:45

Google-fu:阅读 PHP 官方网站的内容

Google-fu: read what the PHP official site writes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文