交响乐 2 php.ini date.timezone

Symfony 2 php.ini date.timezone

我在 xampp 上本地设置 Symfony 2 时遇到问题。 安装没问题,但是当我执行 check.php 它说:

Your system is not ready to run Symfony2 projects 
 * date.timezone setting must be set
   > Set the "date.timezone" setting in php.ini* (like Europe/Paris).

但是php.ini中的date.timezone已经设置正确了。

您可以将此添加到您的 AppKernel.php

public function init()
{
    // get rid of Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone
    date_default_timezone_set( 'Europe/Paris' );
    parent::init();
}

对我有用的是在重新启动 Apache 时添加 -k 选项

如果您遇到以下问题:

Your system is not ready to run Symfony2 projects 
 * date.timezone setting must be set
> Set the "date.timezone" setting in php.ini* (like Europe/Paris)

只需将 app/Resources/views/base.html.twig 文件中的 |localizeddate('long','long') 替换为 |date('r')。

出于某种原因,您必须更改

中的 date.timezone

php.ini

cli folder

当我尝试在 Symfony3 中开始一个新项目时得到了提示。

即使 phpinfo() 显示

php.ini file is in apache2 folder