1

可能重复:
PHP - 依赖系统的时区设置是不安全的

我在 symfony 1.4/propel 1.4 中有一个现有项目。它在生产服务器(RedHat)和我的本地开发环境(Windows 7 上的 WAMP 服务器)上运行良好。

我正在设置一个新的扩展服务器,在 OpenSuse 12.1 上运行,用于通过 Intranet 进行本地办公室测试。

一切都很好,但我在 HTML 页面上收到以下警告

Warning: date() [function.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 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfRootConfigHandler.class.php on line 91

Warning: date() [function.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 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfDefineEnvironmentConfigHandler.class.php on line 66

Warning: date() [function.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 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfDefineEnvironmentConfigHandler.class.php on line 66

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfRootConfigHandler.class.php:91) in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/storage/sfSessionStorage.class.php on line 93

Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/storage/sfSessionStorage.class.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfRootConfigHandler.class.php:91) in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 336

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/config/sfRootConfigHandler.class.php:91) in /home/admin/svntestco/troupasvn/trunk/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357

我知道问题出在某些时区设置上,但我不知道如何解决。我试图找出正在使用的 php.ini 文件,但无法通过 Yast 安装 php。有人可以提供文件名(可能是 php.ini)、它在 opensuse 上的位置以及修复该问题所需的更改。

请注意,我们使用的是 nginx,而不是 apache。

4

1 回答 1

1

对于 Symfony,你应该看到你已经安装了php_intl扩展。我有问题。

第二个是你应该在你的php.ini文件中设置你的时区。

php.ini

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/Berlin 

例如。

于 2012-10-11T12:26:01.580 回答