我只是在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 没有值没有值
同一页面(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模块有关吗?什么是解决这个问题的最佳方法。
答案 0 :(得分:0)
这是我今天早上发现的快速解决方案,
在httpd.conf
行PHPIniDir
"H:/PHP"
应该这样
"J:/PHP"
答案 1 :(得分:-1)
US / Central不是PHP的有效时区。
有效的美国时区在这里:http://www.php.net/manual/en/timezones.america.php
对于中部时间而言,使用America / Chicago。