MAMP/Symfony:MAMP覆盖了php.ini中的date.timezone设置,Symfony失败 [英] MAMP / Symfony: MAMP overrides date.timezone setting from php.ini, Symfony fails

查看:84
本文介绍了MAMP/Symfony:MAMP覆盖了php.ini中的date.timezone设置,Symfony失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在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:

警告:date_default_timezone_get() [function.date-default-timezone-get]:依赖于 系统的时区设置.您需要使用 date.timezone设置或date_default_timezone_set()函数.在 如果您使用了这些方法中的任何一种,但仍会得到此方法 警告,您很可能拼错了时区标识符.我们 在"EST/-5.0/no DST"中选择"America/New_York" /Applications/MAMP/htdocs/Symfony/app/SymfonyRequirements.php在线 434

Warning: date_default_timezone_get() [function.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 'America/New_York' for 'EST/-5.0/no DST' instead in /Applications/MAMP/htdocs/Symfony/app/SymfonyRequirements.php on line 434

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失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆