MAMP/PHP.INI:"date.timezone" phpinfo()中的设置显示“无值";即使该值是在php.ini中设置的 [英] MAMP / PHP.INI: "date.timezone" setting in phpinfo() shows "no value" even though the value is set in php.ini

查看:191
本文介绍了MAMP/PHP.INI:"date.timezone" phpinfo()中的设置显示“无值";即使该值是在php.ini中设置的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

StackOverflow大师的问候!

Greetings to StackOverflow gurus!

这是我正在努力解决的问题.

Here's the issue I'm struggling with.

我在MAMP中运行phpinfo(),结果表在date.timezone行的两列中均显示无值".

I run phpinfo() in MAMP, and the resulting table shows "no value" in both columns of the date.timezone row.

此外,页面显示以下内容:

Additionally, the page displays the following:

警告::phpinfo()[function.phpinfo]:依靠系统的时区设置并不安全. 要求使用date.timezone设置或date_default_timezone_set()函数.如果您使用了这些方法中的任何一种,并且仍然收到此警告,则很可能您拼写了时区标识符.我们在/Applications/MAMP/bin/mamp/phpinfo.php

Warning: phpinfo() [function.phpinfo]: 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/bin/mamp/phpinfo.php

但是,在php.ini文件中,设置如下:

In thr php.ini file, however, the setting is as follows:

date.timezone =美国/纽约

date.timezone = America/New_York

我预见了建议,以检查php.ini的路径是否正确-我已经做到了,并且该路径的确正确:/Applications/MAMP/conf/php5.3/php.ini-即设置了值的文件.

I foresee the recommendation to check that the path to php.ini is correct - I've already done that, and the path is indeed correct: /Applications/MAMP/conf/php5.3/php.ini - that IS the file that has the value set.

如何解决该问题?我想念什么?

How can I remedy the issue? What am I missing?

感谢知识渊博的人的帮助.

Would be grateful for help from a knowledgeable person.

推荐答案

如果在相关的php.ini文件中正确设置了时区,但仍收到此消息,则可以尝试设置TZ环境变量.编辑您的.profile文件以添加以下行(在您自己的时区字符串中) :

If the timezone is set correctly in the pertinent php.ini file and you are still getting this message, you can try setting your TZ environment variable. Edit your .profile to add the following line (sub in your own timezone string):

export TZ="America/New_York"

不确定为什么(a)MAMP会覆盖您的php.ini设置,(b)使用TZ env变量时,PHP不会发出通知/警告,即使它说可以,但是此解决方案对我来说使用MAMP有用使用PHP 5.3.6的2.0.5.

Not sure why (a) MAMP overrides your php.ini setting, (b) PHP doesn't throw a notice/warning when using the TZ env variable even though it says it will, but this solution worked for me using MAMP 2.0.5 with PHP 5.3.6.

这篇关于MAMP/PHP.INI:"date.timezone" phpinfo()中的设置显示“无值";即使该值是在php.ini中设置的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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