# What is OpCache and how can it be controlled?

> OpCache speeds up PHP sites by storing compiled code so the server does not have to recompile it on every request.

Source: https://www.kualo.com/knowledgebase/perf-speed/what-is-opcache-and-how-can-it-be-controlled
Updated: 2026-06-04

---

OpCache speeds up PHP sites by storing compiled bytecode so the server does not have to recompile your scripts on every request. Here is how it works and how you can control it.

## What is OpCache?

To understand OpCache, it helps to know that PHP scripts are uncompiled, human-readable code. That is part of what makes PHP useful - you do not need to compile your code before running it, as you do in many other languages.

Without OpCache, every time a PHP script runs, the server must compile it into "opcode" - executable machine code that the server can process. With OpCache enabled, that compiled opcode is stored on disk. The next time the same script runs, the server skips the compilation step entirely, which means less work and faster responses.

The cached version of a file is automatically discarded whenever that file is modified, so you will always be running the latest code.

## Caching more than just PHP code

Applications can also store other data in OpCache, such as objects. Because this data is not tied directly to a specific PHP file, the server cannot automatically detect when it needs to be refreshed. For this reason, OpCache can be reset programmatically by your application whenever it is needed.

Many applications handle this natively, or offer a plugin or extension that triggers a cache reset after updates.

## How Kualo keeps your OpCache warm

Some hosts reset OpCache every time the web service restarts - for example, when a domain is added to or removed from the server. On a busy server, this can happen hundreds of times per hour. If your site relies heavily on OpCache, resetting it that frequently is counterproductive.

To avoid this, we run PHP in detached mode. This means your OpCache is not cleared on every web service restart, so it stays fully primed. Any resets are handled at the application level, where they belong.

## Clearing OpCache manually

If your application does not automatically clear OpCache after an update, you can do it yourself from within cPanel.

1. Log in to cPanel.
2. Locate the **Clear OpCache** button (found in the PHP or caching tools area).
3. Click it to purge your entire OpCache immediately.

:::tip
If your site is running slowly, check your [PHP extensions in cPanel](/knowledgebase/cpanel-how-tos/how-to-manage-the-php-version-in-cpanel-using-the-select-php-version-tool) and confirm that OpCache is enabled.
:::

---

_Source: Kualo Knowledgebase — https://www.kualo.com/knowledgebase/perf-speed/what-is-opcache-and-how-can-it-be-controlled · © Kualo Ltd._
