Skip to content

PHP Opcache Settings to Speed Up Multiple WordPress Sites

Watch on YouTube.

If you are running multiple WordPress websites on a single VPS or dedicated server, you might notice things slowing down as you add more sites or plugins.

One of the most overlooked ways to fix this is by optimizing your “PHP Opcache”.

What is Opcache?

By default, PHP has to load, parse, and compile your WordPress files every single time a page is requested.

Opcache speeds this up by storing the compiled “machine code” in your server’s RAM. The next time a visitor hits your site, PHP pulls the code straight from memory, skipping the heavy lifting.

The Problem with Default Settings

Most servers come with a default allocation of “128 MB” of memory and a limit of “10,000” files.

While this is fine for one WordPress website. Multiple WordPress sites with several plugins can easily eat through those limits.

When the cache is full, your server starts compiling files from scratch again, making your sites feel slow.

3 Key Settings to Change

To handle multiple WordPress sites effectively, you should look into your php.ini file and adjust these three values:

  1. opcache.memory_consumption: Increase this (e.g., to 600MB needed for 6 WordPress websites in my case) so all your site files can fit in the RAM.
  2. opcache.interned_strings_buffer: Increase this (e.g., to 64MB) to better handle the strings used within your PHP files.
  3. opcache.max_accelerated_files: Increase this (e.g., to 25,000) to ensure every single plugin and theme file across all your sites is indexed.

Main goal is to make sure that all php files fit into OpCache memory. Otherwise your websites will remain slow.

You need to find suitable values for your server using OpCache Stats tool (link below). It is a free single file tool that will show OpCache usage on your web server across all websites.

After changing these settings wait couple hours or a day then check “Opcode status” to see if new values are enough for handling all your existing websites.

The Results

In our testing, optimizing these settings led to:

  • 2x Faster — page generation times.
  • 5x Less memory usage — per page request.

By making sure your server has enough “room” to store your code, you ensure that your WordPress dashboard and front-end stay fast.

What is next:

Leave a Reply

Your email address will not be published. Required fields are marked *