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?


基础教程推荐
- Libpuzzle 索引数百万张图片? 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01