简体   繁体   English

PHP 我的时区在PHP.ini文件中没有设置 xampp

[英]PHP my timezone is no setting up in PHP.ini File in xampp

I've xampp installed on my Local PC.我在本地 PC 上安装了 xampp。 But I've a Problem in my Timezone.但我的时区有问题。 PHP date shows my Date & Time 02/11/2018 05:26:18 . PHP 日期显示我的日期和时间02/11/2018 05:26:18 but my PC Time is 02/11/2018 09:26:18 .但我的电脑时间是02/11/2018 09:26:18 My Timezone is Asia/Karachi.我的时区是亚洲/卡拉奇。 I've Changed My Timezone in php.ini and My Timezone in php.ini Look like this我已经更改了 php.ini 中的我的时区和 php.ini 中的我的时区看起来像这样

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Karachi"

I've also changed the right php.ini file according to phpinfo.我还根据phpinfo更改了正确的php.ini文件。 I've restarted my Server many times but still getting the same timezone.我已经多次重启我的服务器,但仍然得到相同的时区。 My PHP version is 7.1.10我的PHP版本是7.1.10

I've xampp installed on my Local PC.我已经在本地PC上安装了xampp。 But I've a Problem in my Timezone.但是我所在的时区有问题。 PHP date shows my Date & Time 02/11/2018 05:26:18 . PHP日期显示了我的日期和时间02/11/2018 05:26:18 but my PC Time is 02/11/2018 09:26:18 .但我的电脑时间是02/11/2018 09:26:18 My Timezone is Asia/Karachi.我的时区是亚洲/卡拉奇。 I've Changed My Timezone in php.ini and My Timezone in php.ini Look like this我已经更改了php.ini中的我的时区和php.ini中的我的时区

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Karachi"

I've also changed the right php.ini file according to phpinfo.我还根据phpinfo更改了正确的php.ini文件。 I've restarted my Server many times but still getting the same timezone .我已经多次重启服务器,但是仍然得到相同的时区。 My PHP version is 7.1.10我的PHP版本是7.1.10

As @Shaida Muhammad suggested in comments to the question, there seems to be a second date.timezone in php.ini for xampp.正如@Shaida Muhammad 在对该问题的评论中所建议的那样,php.ini 中似乎有第二个 date.timezone 用于 xampp。 You can safely remove/comment the second date.timezone.您可以安全地删除/评论第二个 date.timezone。

[Date]
date.timezone=Asia/Kolkata

I have had the same issue, instead of going everywhere else i just clicked on Apache config button in xampp control panel and clicked on php.ini.我遇到了同样的问题,我没有去其他地方,而是点击了 xampp 控制面板中的 Apache 配置按钮,然后点击了 php.ini。

There is a second timezone line in that file go and search for it you will find your solution there.该文件 go 中有第二个时区行并搜索它,您将在那里找到您的解决方案。

[Syslog]
define_syslog_variables=Off
[Session]
define_syslog_variables=Off
[Date]
date.timezone=Asia/Karachi
[MySQL]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM