在 Ubuntu 13.10 机器上构建 Symfony2 应用程序。并收到一个错误,导致我在我的 php.ini 文件中找到 date.timezone 值。默认构建中未设置此值,因此得到以下内容
ContextErrorException: Warning: date_default_timezone_get(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/test9/app/cache/dev/classes.php line 5419
在这个灯组中,.ini 文件位于/etc/php5/apache2/php.ini 并且我已经用 US/Pacific、America/Los Angeles & PST 对其进行了编辑……但是这些编辑都没有删除错误。之后我尝试重新启动 httpd,但不确定从这里转向哪里。测试 phpinfo() 指向正确的位置。所以不确定我在这里遗漏了什么。
最佳答案
这是一个典型的愚蠢错误。我已将正确的 date.timezone = UTC 值添加到我的 apache2 和 cli php.ini 文件中。我只是没有意识到分号是那种格式的注释。所以它没有注册。现在可以使用了……不过请注意,请确保您已更新 apache2.conf 和 cli 中的时区值以避免错误
关于php - Ubuntu 上下文错误默认时区上的 Symfony2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20483830/