Ubuntu上下文错误默认时区的Symfony2

时间:2013-12-10 00:38:16

标签: php apache symfony ubuntu

在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,并且我已经在美国/太平洋地区,美国/洛杉矶& PST ...但这些编辑都没有删除错误。我之后尝试重新启动httpd,但不确定从何处转过来。测试phpinfo()指向正确的位置。所以不确定我在这里失踪了什么。

1 个答案:

答案 0 :(得分:1)

这是一个经典的愚蠢错误。我在我的apache2和cli php.ini文件中添加了正确的date.timezone = UTC值。我只是没有意识到分号是这种格式的评论。所以它没有注册。它现在有效......虽然注意,请确保你已经更新了apache2.conf和cli中的时区值以避免错误