• Resolved technabob

    (@technabob)


    I just migrated my sites to a new server, and now all of my posts are going live 4 hours early. I’ve already checked the server time (with the unix “Date”) command, the timezone in php.ini, and the timezone in WordPress itself. They all show the correct time (CDT).

    WordPress displays the correct time in the UI when I look under settings > general.

    However, if I look at the future cron jobs scheduled, the time for publish_future_post is being set 4 hours early.

    I have another server from the same host, and all the configurations appear to be identical, and the problem doesn’t occur on this server.

    Any ideas what else could be causing this? I’m totally baffled.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    were the posting times set on the old server (then migrated) or on the new one? I’m thinking that the time settings on the old server may have been incorrect.

    Thread Starter technabob

    (@technabob)

    Nope. These are brand new posts, created on the new server. It’s a real headscratcher.

    Thread Starter technabob

    (@technabob)

    When I compare the values in my two different servers, I notice that the site with the problem is recording GMT INCORRECTLY in the database:

    For instance on the server with the problem:
    post_date: 2016-08-04 00:01:00, post_date_gmt: 2016-08-04 01:01:00

    And the server without the problem:
    post_date: 2016-08-04 00:01:00, post_date_gmt: 2016-08-04 05:01:00

    PHP seems to know the proper difference between GMT and CDT, but whatever is recording the post_date_gmt to the database doesn’t seem to.

    I’m currently thinking it’s something in the get_gmt_from_date logic in /wp-includes/formatting.php, but that’s above my paygrade.

    Thread Starter technabob

    (@technabob)

    SOLVED!

    Turns out that WordPress interchangeably uses UTC and GMT in its code, and my server wasn’t returning UTC properly, due to a corruption of the timezone file for UTC under /usr/share/zoneinfo. I simply copied the GMT file to the UTC file, and the problem is solved.

    Anyone on MediaTemple with this problem should check /usr/share/zoneinfo, and if the UTC and GMT files aren’t the same, you have the same issue.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    That is some very impressive sleuthing.

    uploading a beer for you!

    Thread Starter technabob

    (@technabob)

    Haha. I could use one after all of that. Who knew that GMT and UTC could be different.

    Easiest way to test if a server has the problem. In the shell run these two commands back to back:

    TZ="UTC" date
    TZ="GMT" date

    If they’re different – bad juju.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Scheduled Posts 4 Hours Early’ is closed to new replies.