操作系统:Ubuntu 13.2 Symfony2 版本:2.3
我可以创建我的 Test.orm.yml
文件并创建我需要的 ../Bundle/Entity/Test.php
现在我需要我的(是的,现有的)MySQL 数据库中的表,所以我运行以下命令:
app/console doctrine:schema:update --force
结果是错误/警告:
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/html/symfony2/vendor/monolog/monolog/src/Monolog/Logger.php line 112
我检查了我的 php.ini
文件
[文件:/etc/php5/apache2/php.ini
]
(这是我运行 phpinfo()
时显示的文件)
我已经添加了以下行:
date.timezone = "Europe/Berlin"
顺便说一句。 Symfony/config.php
显示一切正常!那里甚至没有显示信息或警告!
谁能帮我解决这个问题? Symfony2 快把我逼疯了,但我必须完成那个项目!
提前致谢!
艾伦
最佳答案
我之前遇到过这个问题,对我来说这是关于不同的环境。您可能在开发环境中运行您的应用程序,并且 doctrine 命令针对生产环境。
首先,尝试运行这些命令以查看是否是原因:
app/console doctrine:schema:update --force --env dev
app/console doctrine:schema:update --force --env prod
然后你应该在切换环境后尝试一个phpinfo(),看看是否加载了其他*.ini文件
关于date - Symfony2/Doctrine "app/console doctrine:schema:update --force"带来一个 ContextErrorException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19621800/