Author Topic: DB Time: NOT OK using MSSQL  (Read 11276 times)

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« on: May 21, 2009, 10:49:40 AM »
Hello all,

I'm new to RoundCube, so please be gentle.

I originally installed and had everything working using MySQL, but then discovered that it should work with MSSQL.  I mainly use MSSQL and have my hMailServer running under the same.  I'd rather use MSSQL.

I followed instructions found on this forum to connect to MSSQL but was having problems with the login giving me the dreaded "Session Invalid" error on Login.

I ran the installer and on Step 3 under "Check configured database settings" it shows "DB Time:  NOT OK (Database time differs from PHP time)"

Everything (PHP 5.2.9-2, MSSQL 2005 SP3, IIS6, hMailServer 5.1.1-B341 and RC 0.2.2) are running on the same Windows 2003 server.

I could go back to MySQL, but I hate to further learn and administer another Database System just for one application.

Any help here would be greatly appreciated.
« Last Edit: May 25, 2009, 06:25:53 AM by djamell »

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #1 on: May 22, 2009, 10:24:29 AM »
Bump please.

I figure since the installer checks for it, someone should know why it fails and possibly how to fix it.

Thanks again in advance for anyone who can shed some light on this.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
DB Time: NOT OK using MSSQL
« Reply #2 on: May 22, 2009, 02:11:34 PM »
have you tried making a page which shows you the time that PHP reports and the time that MSSQL reports? if they are both on the same machine then may be it is something like one is set to observe summer time and one is not? just an idea.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #3 on: May 22, 2009, 05:18:42 PM »
Sadly, I am not a developer and don't currently have the necessary skills to come up with the script by myself.

Can you get me started with a little sample script?

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #4 on: May 25, 2009, 06:26:55 AM »
Anyone else?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
DB Time: NOT OK using MSSQL
« Reply #5 on: May 25, 2009, 03:03:12 PM »
take a look in installer/test.php and you can see where it compares the times on the webserver and the database, around line 200. you can add some echos (`echo $tz_local . '
';`) to make it show what the actual times are. Also looking at the code, does the error message not say what the difference is (in seconds)?
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #6 on: May 27, 2009, 11:23:58 AM »
I can see in the code where it's supposed to display the difference in time, but nothing appears there.  It's just blank.  When I add the echo you recommended, what I get back is something like (1243437880).

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #7 on: May 27, 2009, 11:43:32 AM »
Looking more at the code of /Installer/test.php I find the following.

First, the spot that is supposed to display the difference in time contains {$td_ziff} and I don't see this defined anywhere.

Second, I echo'd some more variables.

Using MSSQL I get.

($tz_local) = (1243438774)
($tz_db) = (1243420774)
($tz_diff) = (18000)

Using MySQL I get

($tz_local) = (1243439003)
($tz_db) = (1243439003)
($tz_diff) = (0)

So, why is MSSQL off by 18000 and how do I fix it?

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #8 on: May 30, 2009, 07:36:50 AM »
Bump, please.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
DB Time: NOT OK using MSSQL
« Reply #9 on: May 30, 2009, 08:06:21 AM »
From your other post about the message date/time it looks to me like your PHP is set to use GMT and your MSSQL is set to CDT (GMT -5). I'm not sure exactly where you change the timezones so check your php config file.

Looking in mine I see:
; Defines the default timezone used by the date functions
;date.timezone =

If this is in your config and set to GMT then it could be the culprit.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #10 on: May 30, 2009, 08:19:27 AM »
Here are my current settings.


PHP.ini Timezone Setting

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
;date.timezone = "US/Central"


RoundCube main.inc.php Timezone Setting

// use this timezone to display date/time
$rcmail_config['timezone'] = 'auto';


What should I do differently?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
DB Time: NOT OK using MSSQL
« Reply #11 on: May 30, 2009, 09:16:28 AM »
well that line in your php.ini is commented out isnt it so it wont be makeing any difference. Try uncommenting it and see if it makes any difference.

I think your PHP time should be the same as your server time, and it is the same as your MySQL time. Is it possible that your server is set to GMT and your MSSQL is set to CDT or vice versa?

The RC config settings really don't matter right now. The problem is your server setup its nothing to do with RC.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #12 on: May 30, 2009, 10:45:09 AM »
Oops.  OK, I uncommented it and restarted IIS.  No difference.

Also, everything (hmailServer, MSSQL, MySQL, PHP, RC) is all running on one box which is set to the Central US Timezone.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
DB Time: NOT OK using MSSQL
« Reply #13 on: May 30, 2009, 01:32:14 PM »
There must be something in one of the configs which is messing with the timezone since you have already proved that not everything is set to CDT. I don't know much about setting up IIS and PHP etc so I cant help.

I know there are other people on the forum who run windows servers may be one of them have some ideas or make some test pages and hit the internet and research.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline djamell

  • Jr. Member
  • **
  • Posts: 17
DB Time: NOT OK using MSSQL
« Reply #14 on: May 31, 2009, 05:28:33 PM »
Surely someone else has run into this before.