5

If I try to publish posts immediately, they get scheduled for the current time but are published 2 hours later.

enter image description here

Also scheduled posts are published 2 hours after the planned time.

In think its a timezone issue but I've no clue where to look else:

Wordpress Setting: enter image description here

PHP Setting: enter image description here

I'm on Ubuntu 16.04 and the timezone seems to set there correct, too.

# timedatectl
  Local time: Sat 2016-10-01 18:04:13 CEST
  Universal time: Sat 2016-10-01 16:04:13 UTC
  RTC time: n/a
  Time zone: Europe/Berlin (CEST, +0200)
  Network time on: yes
  NTP synchronized: yes
  RTC in local TZ: no

mysql @@global.time_zone was set to SYSTEM, I tried to change it to UTC, but that doesn't fix the problem neither:

mysql> SET @@global.time_zone = '+00:00';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| +00:00             |
+--------------------+
1 row in set (0.00 sec)

Do you have any hints where else I could look?

Update1:

I tried to populate timezones to mysql to set default time_zone to 'Europe/Berlin", but no luck:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot mysql

mysql> SET GLOBAL time_zone = 'Europe/Berlin';
mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| Europe/Berlin      |
+--------------------+
1 row in set (0.00 sec)
6
  • Try scheduling the job 2 hours from Berlin time. See what happens.
    – snowYetis
    Commented Oct 1, 2016 at 18:12
  • If I schedule a post on a specific time, its published excatly 2 hours after that time. Commented Oct 1, 2016 at 18:33
  • Are your posts being moderated?
    – snowYetis
    Commented Oct 1, 2016 at 18:38
  • no, they aren't moderated Commented Oct 1, 2016 at 18:48
  • I'd suggest checking the time zone / time on your MySQL server / software. The post data will be put into the db first and then published. So if everything in your db is effectively written 2 hours from the actual time it's saved. Commented Oct 1, 2016 at 22:44

1 Answer 1

5

The solution was to

apt-get remove tzdata
apt-get install tzdata

while

dpkg-reconfigure tzdata

was not enough.

Mark's edit:

In human words, the problem was caused because the time zone data on the server was incorrect, which probably had an impact how php calculates times. The solution was to forcefully update the data.

1
  • Editted to make it a little less technical. Feel free to edit my edit ;) Commented Oct 3, 2016 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.