One WordPress timezone problem solved

15 June 2009 · 2 comments

Making sure WordPress was using the correct version of PHP solved one timezone problem that turned up with the update to v2.8.

 

After updating 5 blogs to WordPress v2.8 I found 3 of them offered the new timezone handling, while the other 2 did not. I wrote about timezone support in WordPress Daylight Savings is finally fixed (sort of).

WordPress old timezone handler.

Initially I tried the WordPress forums, but without luck. I’d have to solve this by myself.

Was it when I updated that made a difference?

Obviously something was different between the working and the non-working blogs, so I started by looking at the file /wp-includes/version.php. That file shows what version of WordPress the blog is running.

In fact, on one non-working blog I tried to trick WordPress by editing the version number and date to be older than v2.8. That did indeed fool WordPress and I was able to once again choose an automatic update from within the blog’s Dashboard.

That fresh update changed nothing, thus disproving my theory that perhaps the updater had changed between the time I updated the first (non-working) blog and the later successful update on another blog.

Let’s check the Settings file

Next I figured I’d compare the relevant Settings files from the two blogs.

kit-no-diffs-01.jpg.
I opened the /wp-admin/options-general.php from each blog into BBEdit and chose the most wonderful Compare Two front Documents item from the Search menu. I was confident that I’d find there were differences.

Yup, that theory was wrong too: No differences. These files are identical. OK.

The beast awakes

Next up was to look through /wp-admin/options-general.php. I’m no PHP coder, but line 99 caught my eye:

if ( !wp_timezone_supported() ) : // no magic timezone support here

Hmmm, timezone_supported?

Then something stirred in the depths of my brain: these blogs are on different servers. Is it the good old ‘Different versions of PHP’ bug?

I’ve been moving all my blogs to a different hosting company. For some bizarre reason, even though the new company excels at almost everything else, not all their server machines default to PHP5.

I opened the .htaccess file for one of the ‘broken’ blogs and added this line at the top:

AddHandler application/x-httpd-php5 .php

Then I checked the General Settings > Timezone section in the blog’s Dashboard. Success!

WordPress new timezone handler.

If you’ve updated to WordPress v2.8 and the new Timezone support isn’t available to you, check the version of PHP your blog is working with. If it’s still using PHP4 then ask the hosting company how to get PHP5 enabled.

Clip to Evernote

2 comments

Need help with WordPress?
I provide training and support for users of WordPress-based websites. Contact me for more information.

The Thesis Theme for WordPress (affiliate link) saves me heaps of time. Buy it and find out for yourself.
Thesis Theme for WordPress:  Options Galore and a Helpful Support Community.

Tell us what you think.
Note: there may be a delay before your comment appears. I now approve all comments from new visitors, in an attempt to keep spam at bay.

{ 2 comments… read them below or add one }

Otto 01 July 2009 at 03:20 28

Yeah, PHP4 is becoming more and more of a problem for new features in WordPress. We decided that implementing our own timezone list and support in PHP4 instead of simply using the built in capabilities of PHP5 simply wasn’t worth the extra code and effort.

PHP4 is basically dead. While WordPress still runs on PHP4 (and will for the foreseeable future), you’ll probably increasingly find minor features that are exclusive to PHP5, so that should be something you check for on any new web hosting service. Many software packages have dropped PHP4 support entirely now. See http://gophp5.org/ .

Reply

mike 22 August 2010 at 18:23 51

I had a weird problem where my Wordpress comments were doubling and tripling and basically coming back even after I deleted them, but in Disqus they was fine.

I suspected a timezone conflict between the two and ended up checking out PHP based on your post. That basically fixed it.

Even though the server was running PHP5, I had to set PHP5 as the default php.ini through cpanel and since then, so more problem with mutating comments.

Reply

Add your Comment

Older Post:

Newer Post: