问题描述
我正在尝试在MAMP中配置Symfony2框架.
I'm trying to configure Symfony2 framework in MAMP.
在php.ini
中,我已经正确设置了date.timezone
,但是,似乎MAMP会以某种方式覆盖该设置并改为使用系统时间.
In php.ini
I have correctly set date.timezone
, however, it appears that MAMP somehow overrides the setting and uses system time instead.
结果,Symphony的config.php
页面发送此警告:
As a result, Symphony's config.php
page sends this warning:
Symfony在修复此问题之前无法显示起始页.解决办法是什么?
Symfony fails to show start page until this has been fixed. What would be the solution?
谢谢!
推荐答案
我仍在研究为什么MAMP覆盖php.ini date.timezone设置的原因和方式,但是,我在Symfony php中找到了快速解决方案文件,至少在目前为止,该文件已解决了该问题.
I am still working on figuring out why and how MAMP overrides the php.ini date.timezone settings, however, I have found the quick fix solution within Symfony php files, which solved the problem, at least for now.
我添加了以下代码:
date_default_timezone_set ('America/New_York');
-在Symfony的config.php和app_dev.php文件的顶部,紧接在脚本顶部的php标签之后.这消除了警告消息,并使Symfony在MAMP上工作.
-- at the top of Symfony's config.php and app_dev.php files, immediately after the opening php tag, at the very top of the script. This removed the warning message and got Symfony working on MAMP.
我预见到必须不断将相同的代码添加到Symfony中的其他php文件中,因为我一直对此进行黑客攻击,这应该不是问题.或者,我可能会弄清楚如何覆盖MAMP的覆盖.
I foresee having to add the same code to some other php files inside Symfony as I keep hacking at it, which shouldn't be a problem. Or I may figure out how to override MAMP's overriding.
仍然,这是一个可行的解决方案.
Still, this is a workable solution.
这篇关于MAMP/Symfony:MAMP覆盖了php.ini中的date.timezone设置,Symfony失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!