0

In General settings, local time is shown as equivalent to (the correct) UTC time. enter image description here

No other settings are shown below the error and there is no Save Changes button.

In logging, I see the following, when I grep for timezone in a list of options with wp option list | grep -i zone:

PHP Warning:  timezone_open(): Unknown or bad timezone (America/Phoenix) in /var/www/union_made_sites/shirts/wp-includes/functions.php on line 5228
Warning: timezone_open(): Unknown or bad timezone (America/Phoenix) in /var/www/union_made_sites/shirts/wp-includes/functions.php on line 5228 
timezone_string America/Phoenix 

Here are the results of a test file that contains the following php code:

<?php
require_once("../../../../wp-load.php");
echo date('Y-m-d G:i:s');
?>
<p>
<?php 
echo current_time('mysql'); 
?>
<p>
<?php
echo "This is GMT Offset:";
echo get_option('gmt_offset');
?>

enter image description here

I'm on Ubuntu, and I'm using /etc/php/7.3/apache2/php.ini to configure mod_php. I've set date.timezone explicitly in this file as follows:

date.timezone = "America/Phoenix"

I can confirm this particular .ini file is loaded via phpinfo(): enter image description here

None of the plugins that are active are associated with calendars or scheduling.

In the wp_options table of the database, the timezone_string option has a value of America/Phoenix, but gmt_offset is an empty string.

Updating the table and setting gmt_offset to -7 does nothing to improve things, aside from showing the correct local time in the General settings screen; wp-cli still throws the same error, the warning regarding "technical difficulties" displays, and the bottom half of the General settings screen does not appear.

2

When I began troubleshooting this issue, I viewed the lack of a value for gmt_offset as the culprit, and considered the server to be solid. But after I updated the gmt_offset value in the database and the error persisted, I knew I'd been mistaken.

An admin had posted to a WP forum indicating that, despite having a valid timezone, things were amiss. His issue was circular soft-linking of timezones (America/New_York linked to EST, which itself was a softlink that linked back to America/New_York). Upon reading that, I'd confirmed that this wasn't the case on my own server.

However, coming back to checking over the system, I noticed that when I compared permissions of the timezone files (yes, it's always permissions) on another environment (which was working fine), I noticed this discrepancy between the working environment (top)...

]# ls -alh /usr/share/zoneinfo/America/Phoenix 
lrwxrwxrwx 1 root root 15 Aug 31 13:40 /usr/share/zoneinfo/America/Phoenix -> ../SystemV/MST7
]# ls -alh /usr/share/zoneinfo/SystemV/MST7
-rw-r--r-- 1 root root 353 Jul  4 14:46 /usr/share/zoneinfo/SystemV/MST7

... and the problem server...

]# ls -alh /usr/share/zoneinfo/America/Phoenix
lrwxrwxrwx 1 root root 15 Jul  4 14:46 /usr/share/zoneinfo/America/Phoenix -> ../SystemV/MST7
]# ls -alh /usr/share/zoneinfo/SystemV/MST7
-rwxrw---- 1 root root 353 Jul  4 14:46 /usr/share/zoneinfo/SystemV/MST7

chmod 644 and problem resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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