Blog
PerformanceInfrastructure

PHP OPcache: The Biggest Single Performance Win for WordPress

OPcache stores compiled PHP bytecode in memory so WordPress doesn't re-parse hundreds of files on every request. Here's what it does, how much it helps, and how to verify it's working.

If you've optimised your WordPress site — added a caching plugin, compressed images, set up a CDN — and it still feels slow on uncached pages, OPcache is likely where you'll find the remaining gain.

What PHP Does Without OPcache

PHP is an interpreted language. Without OPcache, every request goes through this sequence:

  1. Read the PHP source file from disk
  2. Parse the source code into a syntax tree
  3. Compile the syntax tree to bytecode
  4. Execute the bytecode
  5. Discard the parsed and compiled result

For a WordPress page request, PHP loads and processes hundreds of files — WordPress core, your active plugins, your theme. That parse-and-compile cycle repeats from scratch on every single request.

What OPcache Changes

OPcache intercepts step 3. After the first request compiles a file, it stores the bytecode in shared memory. Every subsequent request that needs the same file skips steps 1–3 entirely and jumps straight to execution.

For WordPress:

The result is 30–50% faster PHP execution for typical WordPress workloads. On a page that takes 400ms uncached, that's 120–200ms recovered without any code changes.

OPcache on TrueCore

OPcache is enabled on all accounts. It's built into PHP 8.x and configured at the server level — there's nothing to install or activate.

The key configuration settings:

When the Cache Gets Cleared

OPcache is cleared automatically when:

You don't need to manually clear OPcache after installing or updating plugins via the WordPress admin — WordPress writes the updated files to disk, OPcache detects the change, and the next request recompiles that file.

If you edit PHP files directly over SFTP or SSH and your changes aren't appearing, OPcache may be serving the old bytecode. Restart PHP-FPM from the terminal (site restart php) to clear it.

Verifying OPcache Is Active

In your WordPress admin, go to Tools → Site Health → Info → Server. OPcache status is listed under the PHP configuration section.

Alternatively, create a temporary file in your web root:

<?php phpinfo(); ?>

Visit it and look for the OPcache section — it shows enabled status, memory usage, and hit/miss statistics. Delete the file afterwards.

OPcache vs Page Caching

These are separate and complementary:

Page caching has a bigger effect on time to first byte for cached pages. OPcache has the bigger effect on uncached pages, logged-in users, and anything that can't be page-cached (checkout pages, admin, REST API requests).

Use both.

Ready for hosting that doesn't oversell?

Get started from £10/mo More articles
Stay in the loop New posts, platform updates, and open chat — join the community.
Join Discord