Immediately published posts are scheduled and published 2 hours later

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)

1
1

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.

Leave a Comment