WordPress requires the json PHP extension: why your site shows it, and the lasting fix
Short answer
Since version 6.8, WordPress checks for two PHP extensions, json and hash, before it loads anything. If one is missing, it stops with this one line and an HTTP 500 error. On WordPress 7.0 and later it can only happen on PHP 7.4: from PHP 8.0, json is always part of PHP. Quick fix: ask your host to enable the json extension, and the site is back. Lasting fix: move to PHP 8.3 or later, where json can’t be missing and security fixes continue, after checking your plugins and theme for that version.
The message
Instead of your site, the browser shows a single line, with your WordPress version in it:
Browser · WordPress’s message, from wp-includes/load.php in WordPress 7.1.2; WordPress fills in its version and the extension
WordPress 7.0.2 requires the json PHP extension.The page comes with HTTP status 500, so hosting logs and browser tools list it as an error 500. The admin area shows the same line: WordPress stops before it loads anything, including the dashboard.
Why your site shows it
WordPress keeps a short list of PHP extensions it can’t run without, and checks it at the very start of every request. The list is json and hash (WordPress 7.1.2 source); the check appeared in WordPress 6.8 (6.8 has the list, 6.7 doesn’t).
On the PHP side, php.net says of json: “The JSON extension is a core PHP extension, so it is always enabled.” (php.net) That holds from PHP 8.0; before, a PHP setup could leave it out. The same is true of hash from PHP 7.4 (php.net).
WordPress 7.0 and later need PHP 7.4 at least. Put together, on a current WordPress the message has one cause: the site runs PHP 7.4 without its json extension.
Quick fix: enable json
- In your hosting panel, look for the PHP extensions of your PHP version (often next to the PHP version setting) and enable
json. - No such list? Ask your host to enable the json extension for PHP 7.4 on your site.
- Reload the site: WordPress checks again on every request, so it works at once.
Lasting fix: leave PHP 7.4
PHP 7.4 hasn’t had security fixes since 28 November 2022 (php.net), and on PHP 8.0 and later json can’t be missing. WordPress 7 runs on PHP 7.4 to 8.5 and wordpress.org recommends 8.3 or greater (WordPress 7’s PHP requirements).
A move from 7.4 crosses PHP 8.0, which removed functions such as create_function() and each() that old plugins still call; every call stops the page (moving from PHP 7.4 to PHP 8). So, once the quick fix has the site running again:
- Check every plugin and your theme for the version you’re moving to.
- Update, replace or fix what will break.
- Switch PHP in your hosting panel (how), and watch the site for a week.
For step 1, CompatNav is a free plugin on wordpress.org that runs on PHP 7.4 and checks the code of every plugin and theme for PHP 8.0 to 8.5. From 7.4 it reports everything that changes up to the version you choose, labelled “Will break” or “Deprecation notice”, on your own server.
The same check, two other messages
The check that shows this message also stops WordPress in two other cases, both with HTTP 500 (WordPress 7.1.2 source):
- PHP too old for WordPress: “Your server is running PHP version … but WordPress … requires at least ….”
- No MySQL extension: a page titled “Requirements Not Met” that says “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” We ran WordPress 7.1.2 on the official PHP 8.4.26 build without
mysqli: that is exactly what came back, with status 500.
Site Health checks a longer list of extensions, required and recommended: “One or more required modules are missing”.
Key takeaways
- WordPress 6.8 and later stop with this message when the json or hash extension is missing.
- On WordPress 7.0 and later, only json on PHP 7.4 can trigger it: from PHP 8.0, json is always enabled.
- Quick fix: have the json extension enabled for PHP 7.4; the site works again at once.
- PHP 7.4 hasn’t had security fixes since 28 November 2022: the lasting fix is PHP 8.3 or later.
- Check your plugins and theme for the new version before you switch: PHP 8.0 removed functions older plugins still use.
Frequently asked questions
Can a plugin cause this message?
No. WordPress checks the extensions before it loads any plugin or theme. The cause is the PHP setup on the server.
Why did it appear after a WordPress update?
Because WordPress 6.7 and older didn’t check for json. A site whose PHP 7.4 had no json extension ran until the update, then stopped at the new check.
Can I enable json myself?
Some hosting panels have a list of PHP extensions to tick for each PHP version. If yours doesn’t, ask your host: it’s their server’s setup.
Check your own site before you upgrade
CompatNav is a free WordPress plugin. It reads the code of your plugins and themes on your own server and tells you, in plain words, what will break and what will only show notices on the PHP version you choose. It never changes your code. It can’t see problems that only appear while code runs with real data, so a quick check of your site after the upgrade still matters.
Sources
- WordPress 7.1.2 source: the PHP checks before loading (load.php)
- WordPress 7.1.2 source: required PHP version and extensions (version.php)
- php.net: JSON installation
- php.net: Unsupported Branches (end of life dates)
About the code examples: each output is the real output of the code shown, run with the official PHP builds, without a php.ini, with all errors reported and displayed. Only the file path was replaced by a neutral server path.