Forum Replies Created

Viewing 1 replies (of 1 total)
  • I was running into this problem. Tracked problem down to the fact WordPress is built assuming MySQL is in traditional mode, while my server had MySQL in strict mode.

    Specifically WordPress has default dates sprinkled throughout the code that are invalid, meaning they work ok if MySQL is in traditional mode, but not if MySQL is strict mode.

    Hence the solution was to either change the MySQL mode to “traditional” or fix the code. Considering I have other services running on the server, I was reluctant to change the MySQL mode, so instead I fixed the dates in the code. Turned out to be easier than it sounds, with this one line fix:

    find . -name "*.php" -print | xargs sed -i 's/0000-00-00 00:00:00/1000-01-01 00:00:00/g'

    …which goes through all the php files and finds the invalid dates 0000-00-00 00:00:00 and converts them to valid 1000-01-01 00:00:00 dates. Its possible plugins + updates I install in the future will use the same bad technique, so I may have to re-run this in the future, not to mention there might be other invalid dates that don’t match 0000-00-00 00:00:00. In any case, the above one liner worked for me.

    Just to be clear, if you’re only running wordpress, its probably wiser and easier to run MySQL in traditional mode. For others, the above mentioned solution might be appropriate.

Viewing 1 replies (of 1 total)