【发布时间】:2014-07-09 04:13:49
【问题描述】:
我只是在 windows OS x64 上创建新服务器。
httpd-2.4.9-win64-VC11
php-5.5.14-Win32-VC11-x64
MySql Server
我进入php.ini取消注释并添加:
date.timezone = "Asia/Kuala_Lumpur"
我在phpinfo.php 中创建并查看,并在本地和主值中找到了我的date.timezone 和no value。
如下
启用日期/时间支持“Olson”时区数据库版本 2014.3 时区 数据库内部 默认时区 UTC
指令本地值主值 date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.583333 90.583333 date.sunset_zenith 90.583333 90.583333 date.timezone no value no value
在同一页面(phpinfo.php)上也出现error message,如下:
Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in J:\WebDocs\gad\phpinfo.php on line 2
Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in J:\WebDocs\gad\phpinfo.php on line 2
这是我目前的php.ini
这与 php.ini 模块有关吗?以及解决此问题的最佳方法是什么。
【问题讨论】:
-
你重启了apache吗?你编辑了正确的 php.ini 吗?
-
@Lashane 是的,我重新启动 apache 并发生同样的情况。
-
确保您正在编辑正确的 php.ini。有些系统有一个单独的 CLI 和 Apache。在 web 文件中运行 phpinfo(),顶部将给出解析后的 ini 文件的路径。
-
请确保您编辑的 php.ini 是 apache 使用的那个。在您的 phpinfo() 中,标题中有一行关于“加载的 PHP 配置”或类似的内容,其中包含 php.ini 的路径。
-
我找到了解决方案,因为睡眠不足我添加了 PHPIniDir "H:/PHP" 这是错误的,应该是 PHPIniDir "J:/PHP"