更改 PHP 错误日志以显示本地时间而不是 UTC

问题描述 投票:0回答:1

在 Windows Server 和美国/洛杉矶运行 PHP 5.4.14 在 php.ini 中设置了 date.timezone,但错误会使用 UTC 时间打印到日志中。有没有办法让日志显示当前当地时间。

php windows
1个回答
0
投票

如果在 php.ini 中设置了这些选项,PHP 将记录错误和警告。

error_reporting = E_ALL
log_errors = On
error_log = C:\some folder\php_errors.log

此选项(在同一文件中)将应用洛杉矶时间而不是 UTC 到每个记录条目的时间戳。

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/Los_Angeles"
© www.soinside.com 2019 - 2024. All rights reserved.