为了在安装 Symfony2 后能够运行此命令,我已尝试了一切方法。
php app/console cache:clear --no-warmup OR php app/console cache:clear
我每次都会收到此错误:
[ErrorException] 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 /Applications/XAMPP/xamppfiles/htdocs/rt/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection Configuration.php line 66
第 66 行:
->scalarNode('default_timezone')->defaultValue(date_default_timezone_get())->end()
我已经尝试过这个堆栈帖子:
我尝试编辑所有 php.ini 文件,XAMPP 的 phpinfo() 显示:
date/time support enabled "Olson" Timezone Database Version 2013.4 Timezone Database internal Default timezone UTC
$ php --ini 显示
Configuration File (php.ini) Path: /etc (I edited this one as well)
php.ini 显示
date.timezone = UTC
如果无法克服这个愚蠢的 date_default_timezone_set() 错误,我就无法运行 php Composer.phar install 。
请帮忙,为了解决这个问题已经讨价还价了两天,我已经无计可施了。
谢谢!
最佳答案
我已经解决了这个问题,将此代码添加到 app/AppKernel.php
文件中:
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel {
public function init() {
// Change timezone
date_default_timezone_set('America/Caracas');
parent::init();
}
// ......
}
关于php - Symfony2 Date.TimeZone() 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23352322/