Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Server time WILDLY and unpredictably wrong

  • oleggorfinkel
  • oleggorfinkel's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 6 months ago #188267 by oleggorfinkel
Server time WILDLY and unpredictably wrong was created by oleggorfinkel
I have two installations of LimeSurvey (both 3.17.7+190627) --one on my PC with XAMPP and another on a regular internet host,-- and both of them seem to have their server time completely off. On localhost where the LimeSurvey server and local system times should always match exactly, LimeSurvey appears to be 7 hours ahead of the system clock (system: 11 am, LS: 6 pm). On the internet host, which I know for a fact is located in France (while I am currently in the Central Standard Time zone), LS server time is only one hour ahead, when it should be 6 hours ahead.

This is the first time I am seeing this kind of a problem with LimeSurvey. Any ideas what could be causing it?

Oleg G.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188268 by tpartner
Replied by tpartner on topic Server time WILDLY and unpredictably wrong
There is a setting for server time offset in the configuration screen.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • oleggorfinkel
  • oleggorfinkel's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 6 months ago - 4 years 6 months ago #188269 by oleggorfinkel
Replied by oleggorfinkel on topic Server time WILDLY and unpredictably wrong

tpartner wrote: There is a setting for server time offset in the configuration screen.


Hi, Tony! Yes, of course, that's exactly where I am looking, and I have already adjusted the offset to compensate for the time difference. My point, though, is that the UNADJUSTED server time itself is wrong, and I don't understand where it is even coming from, as it doesn't correspond to the known server local time (for either of the two hosts). Any insight as to why that is happening?

Oleg G.
Last edit: 4 years 6 months ago by oleggorfinkel.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago - 4 years 6 months ago #188270 by holch
Replied by holch on topic Server time WILDLY and unpredictably wrong
I am currently running Version 3.17.9+190731, so not the latest version, but my timing seems to be totally correct and I hever had noticed any issues in that direction. What is your current version?

For the host it is always possible that they do not host the server where they claim it is hosted. Now with local host, this is a different beast.

Funny enough, I just checked my XAMPP installation and the timing is off by 5h. It says it is 19:32 despite local time being 14:32 on my Windows PC (I don't really use the XAMPP version, so I am running a fairly old version Version 3.15.5+181115).

So the question is: Where is Limesurvey drawing this time from. On Windows it doesn't seem to be the system time. Maybe Apache has it's own time configuration?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 4 years 6 months ago by holch.
The topic has been locked.
More
4 years 6 months ago #188272 by jelo

holch wrote: So the question is: Where is Limesurvey drawing this time from. On Windows it doesn't seem to be the system time.

It gets the time and the timezone from PHP.

date.timezone string
The default timezone used by all date/time functions. Prior to PHP 5.4.0, this would only work if the TZ environment variable was not set. The precedence order for which timezone is used if none is explicitly mentioned is described in the date_default_timezone_get() page. See List of Supported Timezones for a list of supported timezones.


www.php.net/manual/en/datetime.configura...hp#ini.date.timezone

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188274 by holch
Replied by holch on topic Server time WILDLY and unpredictably wrong

It gets the time and the timezone from PHP.


There you go, Jelo for the rescue again.

Now oleggorfinkel just needs to fix the time in PHP for both servers. I don't care about the wrong date on XAMPP as it is purely for testing. My server seems to get it right anyway.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188275 by tpartner
Replied by tpartner on topic Server time WILDLY and unpredictably wrong
Yes, jelo nailed it. Both my XAMPP server (in php.ini, date.timezone=America/Toronto) and my hosted server are correct.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: oleggorfinkel
The topic has been locked.
  • oleggorfinkel
  • oleggorfinkel's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 6 months ago #188280 by oleggorfinkel
Replied by oleggorfinkel on topic Server time WILDLY and unpredictably wrong

holch wrote:

It gets the time and the timezone from PHP.


There you go, Jelo for the rescue again.

Now oleggorfinkel just needs to fix the time in PHP for both servers. I don't care about the wrong date on XAMPP as it is purely for testing. My server seems to get it right anyway.

Thanks, everyone. I was able to set the PHP timezone on my local server, but I can't find the php.ini file on my internet host. I've opened a ticket with my host's support to ask how I can edit php.ini, but they haven't replied yet. The weird thing is that I know for a FACT that my internet server is in France, because I've actually looked up the location of its IP, yet LimeSurvey-reported server time is only an hour ahead of my local CST time. This probably means that my host's default php.ini is misconfigured.

Oleg G.
The topic has been locked.
More
4 years 6 months ago #188282 by jelo

oleggorfinkel wrote: The weird thing is that I know for a FACT that my internet server is in France, because I've actually looked up the location of its IP, yet LimeSurvey-reported server time is only an hour ahead of my local CST time. This probably means that my host's default php.ini is misconfigured.


1. Looking up an IP location is not like GPS. The database you queried can be everything from 100% correct to totally wrong.

2. The PHP.ini time setting is seldom correct these days. You not always want the timezone the server is located. The default setting is UTC, which has no daylighttimesaving changes. Leapseconds are the only change you can expect ;-)

3. Depending on your hosting (dedicated, shared) and setup you don't edit the php.ini directly.
The variable date.timezone is available everywhere (AKA PHP_INI_ALL) for change.
www.php.net/manual/en/configuration.changes.modes.php

You might be able to create or manipulate a file in your reach.
php.ini, .htaccess, httpd.conf or .user.ini
Some hosting concepts allow adding php.ini in webroots to override certain variables
That will mostly be used to assign php scripts different phpversion, amount of memory and runtime.
But a lot more can be changed.

Depends all on your webserver and php gateway.

Other way:
Timezone via htaccess in the LimeSurvey folder could be changed via "SetEnv TZ Europe/Paris"

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: oleggorfinkel
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188309 by holch
Replied by holch on topic Server time WILDLY and unpredictably wrong

but I can't find the php.ini file on my internet host.

I assume you don't really care about the system time that much, do you? What you care about is that the time on Limesurvey is the one you want. So why not just correcting the LS time with the feature in LS. Now that you know why the time is off, this shouldn't be a big deal, right?
Of course, it would be ideal to have the time adjusted in PHP, but if this is not easily possible on your hosted site, why not just leave it and correct it via LS?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: oleggorfinkel
The topic has been locked.
  • oleggorfinkel
  • oleggorfinkel's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 6 months ago #188328 by oleggorfinkel
Replied by oleggorfinkel on topic Server time WILDLY and unpredictably wrong

holch wrote:

but I can't find the php.ini file on my internet host.

I assume you don't really care about the system time that much, do you? What you care about is that the time on Limesurvey is the one you want. So why not just correcting the LS time with the feature in LS. Now that you know why the time is off, this shouldn't be a big deal, right?
Of course, it would be ideal to have the time adjusted in PHP, but if this is not easily possible on your hosted site, why not just leave it and correct it via LS?

I was finally able to set the PHP timezone on my internet server via the following .htaccess command:

php_value date.timezone 'Region/Zone'

Of course, I could have handled this via the offset setting in LS, but I'd rather go to the source of the problem. Besides, I would like to avoid the risk of my hosting provider moving the server again to another locale without prior notice and me only finding out about it when surveys start coming in with the wrong timestamps.

Thanks again, Holch, Tony and Jelo, for your answers and help!

Oleg G.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188359 by holch
Replied by holch on topic Server time WILDLY and unpredictably wrong

but I'd rather go to the source of the problem.

Definitely the cleanest solution. My suggestion was only for the case you won't be able to change it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose