如何设置时区xampp mysql和apache? [英] How to setup timezone xampp mysql and apache?
问题描述
getRates(date('Y-m-d'));
函数getRates($ cDate)
{
$ query =SELECT * FROM randa WHERE date like'$ cDate'// it有时只能工作。
}
?>
然后我意识到日期('Y-m-d')没有返回正确的日期。进入php.ini并更改时区。并且仍然返回错误的日期。
我该如何解决?
谢谢
尝试这个
1)在httpd.conf(\xampp\apache\conf\httpd.conf)中,添加以下行:
SetEnv TZ欧洲/莫斯科
2)编辑php.ini(\xampp\php\php .ini)date.timezone值在[Date]部分:
date.timezone =欧洲/莫斯科
3)在my.ini(\xampp\mysql\bin\my.ini)中,添加或替换它们的内容。
<
default-time-zone =欧洲/莫斯科
重新启动Apache和MySQL
I am using XAMPP - PHP and MYSQL servers. When I tried to use following -
getRates(date('Y-m-d'));
function getRates($cDate)
{
$query = "SELECT * FROM randa WHERE date like '$cDate'" //it only worked at times.
}
?>
Then I realized the date('Y-m-d') does not return the correct date. Went to php.ini and changed time zone. And is still returning the wrong date.
How can I fix this ? Thank you
Try this
1) In httpd.conf (\xampp\apache\conf\httpd.conf) , add the following line:
SetEnv TZ Europe/Moscow
2) Edit php.ini (\xampp\php\php.ini) date.timezone value in [Date] section:
date.timezone = "Europe/Moscow"
3) In my.ini (\xampp\mysql\bin\my.ini) add or replace
default-time-zone = "Europe/Moscow"
Restart Apache and MySQL
这篇关于如何设置时区xampp mysql和apache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!