Php Yosemite上的Symfony date.timezone错误

Php Yosemite上的Symfony date.timezone错误,php,symfony,Php,Symfony,我已经创建了一个新的Symfony项目 $ symfony new my_project 现在它位于名为/Symfony/my_project的文件夹中 在这一点上,我得到: PHP Warning: date(): 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_

我已经创建了一个新的Symfony项目

$ symfony new my_project
现在它位于名为/Symfony/my_project的文件夹中

在这一点上,我得到:

PHP Warning:  date(): 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 phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php on line 262
 ✕  Symfony 2.7.3 was successfully installed but your system doesn't meet its
     technical requirements! Fix the following issues before executing
     your Symfony application:

 * date.timezone setting must be set
   > Set the "date.timezone" setting in php.ini* (like Europe/Paris).
比说

然后,您可以:

* Change your current directory to /Users/[username]/Dropbox/private/dbx/Symfony/my_project

* Configure your application in app/config/parameters.yml file.

* Run your application:
    1. Execute the php app/console server:run command.
    2. Browse to the http://localhost:8000 URL.
现在我不知道Yosemite中的php.ini文件在哪里。我环顾四周,找到了答案,但使用的php.ini不是我编辑的


php.ini文件要编辑在哪个位置?

因为这是基于终端的运行,而不是基于浏览器的运行,所以您可以很容易地找到它。从终端运行以下命令:

php -i | grep "php.ini"
这将输出所使用的php.ini的位置。然后通过任何文本编辑器图形或其他方式编辑文件,并设置适当的时区

希望这有帮助。

尝试修改真正的php.ini,您可以在终端上找到它运行php-i|grep php.ini

请记住,有时只能找到名为php.ini.default的文件,因此必须使用sudo cp php.ini.default php.ini将文件php.ini.default复制到新的php.ini文件中

创建新的php.ini文件后,必须更改权限才能修改内容:

sudo chmod ug+w php.ini
sudo chgrp staff php.ini
现在可以打开文件php.ini并修改date.timezone行

注意:如果行有注释,请记住删除注释

如果这不起作用,请尝试将init函数添加到下面的AppKernel.php文件代码中,这对我很有帮助

<?php     

class AppKernel extends Kernel
{
    // Other methods and variables


    // Append this init function below

    public function init()
    {
        date_default_timezone_set( 'Europe/Paris' );
        parent::init();
    }

}

ifuser.getFavoriteFood==比萨饼| | user.getFavoriteFood==意大利面{emanuele.setMoodhappy;}-哈哈哈,格兰德!:D如果Oktobefriend{FindMeonfbandera and Lombardi}或者{noProblem}