How to setup timezone xampp mysql and apache?(如何设置时区 xampp mysql 和 apache?)
问题描述
我正在使用 XAMPP - PHP 和 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.
}
?>
然后我意识到 date('Y-m-d') 没有返回正确的日期.转到 php.ini 并更改时区.并且仍然返回错误的日期.
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
推荐答案
试试这个
1) 在 httpd.conf (xamppapacheconfhttpd.conf) 中,添加以下行:
1) In httpd.conf (xamppapacheconfhttpd.conf) , add the following line:
SetEnv TZ Europe/Moscow
2) 在 [Date] 部分编辑 php.ini (xamppphpphp.ini) date.timezone 值:
2) Edit php.ini (xamppphpphp.ini) date.timezone value in [Date] section:
date.timezone = "Europe/Moscow"
3) 在 my.ini (xamppmysqlinmy.ini) 中添加或替换
3) In my.ini (xamppmysqlinmy.ini) add or replace
default-time-zone = "Europe/Moscow"
重启 Apache 和 MySQL
Restart Apache and MySQL
这篇关于如何设置时区 xampp mysql 和 apache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何设置时区 xampp mysql 和 apache?
基础教程推荐
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- php中的PDF导出 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php中的foreach复选框POST 2021-01-01
