- Posts: 103
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Server time WILDLY and unpredictably wrong
- oleggorfinkel
- Topic Author
- Offline
- Premium Member
This is the first time I am seeing this kind of a problem with LimeSurvey. Any ideas what could be causing it?
Oleg G.
- tpartner
- Away
- LimeSurvey Community Team
- Posts: 10630
- Thank you received: 3696
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- oleggorfinkel
- Topic Author
- Offline
- Premium Member
- Posts: 103
- Thank you received: 2
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.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11756
- Thank you received: 2753
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.
- jelo
- Offline
- Platinum Member
- Posts: 5070
- Thank you received: 1263
It gets the time and the timezone from PHP.holch wrote: So the question is: Where is Limesurvey drawing this time from. On Windows it doesn't seem to be the system time.
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
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11756
- Thank you received: 2753
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.
- tpartner
- Away
- LimeSurvey Community Team
- Posts: 10630
- Thank you received: 3696
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- oleggorfinkel
- Topic Author
- Offline
- Premium Member
- Posts: 103
- Thank you received: 2
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.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.
Oleg G.
- jelo
- Offline
- Platinum Member
- Posts: 5070
- Thank you received: 1263
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
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11756
- Thank you received: 2753
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?but I can't find the php.ini file on my internet host.
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.
- oleggorfinkel
- Topic Author
- Offline
- Premium Member
- Posts: 103
- Thank you received: 2
I was finally able to set the PHP timezone on my internet server via the following .htaccess command:holch wrote:
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?but I can't find the php.ini file on my internet host.
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?
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.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11756
- Thank you received: 2753
Definitely the cleanest solution. My suggestion was only for the case you won't be able to change it.but I'd rather go to the source of the problem.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.