What PHP OPcache stores
PHP OPcache keeps the compiled form of each PHP file in shared memory. The next request for that file runs the stored copy instead of compiling the source again. It does not store HTML, images, or MySQL results.
The PHP manual, read on 30 October 2026, defaults opcache.enable to 1. At 0, every request compiles the source again. A script cannot turn the setting on with ini_set(). That call can only turn it off, and an attempt to turn it on raises a warning.
- The cache is shared by the PHP workers for that version, not by the browser.
- opcache.enable is a php.ini switch. It is not a WordPress plugin.
- Command-line PHP stays out of the cache unless opcache.enable_cli is 1, and that flag is system-level.
How to check if PHP OPcache is on
Read the value the website is already using before you change it. A shell reading of Off is not proof the site is off.
- In the document root, add a file named info.php whose only statement is phpinfo().
- Open it in the browser and search for Zend OPcache.
- opcache.enable On means web requests use the cache. If the Zend OPcache block is missing, that PHP version is not loading the extension.
- Delete info.php the same day. It prints paths and the loaded ini file.
php -i on the server prints the command-line ini. opcache.enable_cli defaults to 0, so that command often says Off while the website is On. Judge the site from the web phpinfo block.

How to enable PHP OPcache in cPanel
Set the switch in MultiPHP INI Editor for the domain, not in a WordPress plugin. cPanel hosting puts that editor under Software. Changing the PHP version does not itself set opcache.enable.
- Log in to cPanel. On WebJi® the panel link is in the client area, separate from the invoice page.
- Open Software, then MultiPHP INI Editor, and select the domain.
- If opcache.enable is missing from the basic list, switch to Editor Mode.
- Set opcache.enable to 1. Add the line opcache.enable=1 when it is not there.
- Leave opcache.memory_consumption at 128 unless phpinfo later shows the cache is full. The manual minimum is 8.
- Save, reload the site, and open info.php again. opcache.enable should read On. Delete info.php the same day.
If the value stays Off, a php.ini or .user.ini in the site folder is overriding the editor. The same kind of file can pin an old memory_limit. The PHP version guide shows where to look.
WebJi® cPanel hosting lists PHP 8.1, 8.2 and 8.3 in MultiPHP Manager. PHP 8.5 is not in that menu. Email support@webji.services if the app needs a version outside the list. Other extensions, such as mbstring, are toggled in MultiPHP Manager for that same version.
PHP OPcache settings for memory and freshness
These directives decide whether the cache is on, how much RAM it may use, and when a saved file replaces the cached copy. The defaults are the PHP manual values read on 30 October 2026.
| Directive | Manual default | What to do |
|---|---|---|
| opcache.enable | 1 | Set 1 for the website. ini_set() cannot turn it on. |
| opcache.enable_cli | 0 | Leave 0 unless wp-cli or artisan must use the cache. Only the main php.ini can set it. |
| opcache.memory_consumption | 128 MB, minimum 8 | Leave 128 for one WordPress site. When JIT is on, this segment also holds the JIT buffer. |
| opcache.interned_strings_buffer | 8 MB | Leave 8 unless strings exhaust it. Maximum is 32767 MB on 64-bit PHP and 4095 MB on 32-bit. Before PHP 8.4 the cap was 4095 MB everywhere. |
| opcache.max_accelerated_files | 10000 | Keep 10000 for one site. PHP rounds it up to the prime 16229. The allowed range is 200 to 1000000. |
| opcache.validate_timestamps | 1 | Keep 1 while you still edit files. At 0, changes wait for a reset or a PHP restart. |
| opcache.revalidate_freq | 2 seconds | 2 matches the manual. 0 rechecks every request. Ignored when validate_timestamps is 0. |
| opcache.jit | disable | Not required to enable the opcode cache. Before PHP 8.4 the default was tracing. The JIT buffer defaults to 64 MB now and was 0 before PHP 8.4. |
Leave opcache.save_comments at 1. Setting it to 0 drops docblock comments, and code that reads annotations can break. Do not add opcache.fast_shutdown on PHP 8. That directive was removed in PHP 7.2.
Why PHP edits stay hidden after OPcache
A saved PHP file that still behaves the old way is usually a timestamp the cache has not rechecked, or an HTML cache in front of PHP.
If opcache.validate_timestamps is 0, file edits apply only after opcache_reset(), opcache_invalidate(), or a restart of the web SAPI. If it is 1, PHP rechecks every opcache.revalidate_freq seconds. The default is 2. A value of 0 rechecks on every request, and it is ignored when timestamps are off.
Purge the HTML layer separately. LiteSpeed LSCache and a WordPress page-cache plugin store the finished page. Clearing OPcache does not clear that copy, and purging the page cache does not compile the new PHP.
On a VPS, restart PHP-FPM for the version the site uses, or restart LiteSpeed when the handler is lsphp. On cPanel you often cannot restart the pool. Keep validate_timestamps at 1. If opcache_reset() is blocked, email support@webji.services and ask for PHP on that account to be recycled.
Confirm PHP OPcache with phpinfo
After the save, open the same info.php file. You are done when three lines agree: a Zend OPcache heading is present, opcache.enable is On, and Opcode Caching says Up and Running.
If the cache-full count is not zero, raise opcache.memory_consumption above 128 and save again. Do not raise it on a guess. Delete info.php before you leave the folder.
Skipping the compile can shorten the PHP part of the response. There is no single percentage. A page that waits on MySQL, or on a large image, will not feel faster. Time the PHP page, not the hero image.
Enable PHP OPcache on a Linux VPS
A VPS without cPanel has no MultiPHP INI Editor. Edit the file phpinfo names as Loaded Configuration File, then restart that SAPI. Root access for this edit is why the job moves to VPS hosting instead of shared hosting.
PHP-FPM usually reads /etc/php/8.2/fpm/php.ini or /etc/php/8.3/fpm/php.ini. Apache module PHP reads the apache2 copy of the same version. Set opcache.enable=1 in the file the site actually loads. If zend_extension=opcache.so is commented out, uncomment it, then restart only the service that serves the site.
The command-line file, often /etc/php/8.3/cli/php.ini, is a different ini. opcache.enable_cli belongs there, and a normal website does not need it. Those paths exist on a Linux VPS. Shared cPanel does not hand you the system ini.
If the server is LiteSpeed, PHP runs as lsphp, not as php-fpm. Restarting php-fpm changes nothing. Restart the LiteSpeed PHP handler for that version, then purge LSCache if HTML is cached as well.
Frequently Asked Questions
How do I enable PHP OPcache in cPanel?
Open Software, then MultiPHP INI Editor, select the domain, and set opcache.enable to 1. Save, reload a one-file phpinfo page, and confirm Zend OPcache shows opcache.enable On. Delete that file the same day.
How do I check if PHP OPcache is enabled?
Put a file in the document root that only calls phpinfo(), open it, and search for Zend OPcache. On means web requests use the cache. A shell php -i can still print Off, because opcache.enable_cli defaults to 0. Delete the file the same day.
What should opcache.memory_consumption be?
The PHP manual default, read on 30 October 2026, is 128 megabytes, and values under 8 are raised to 8. Leave 128 for one WordPress site. Raise it only when the phpinfo cache-full line is not zero.
Why do my PHP changes not show after OPcache is on?
The compiled file is still in memory. If opcache.validate_timestamps is 0, restart PHP or call opcache_reset() before the new file runs. If it is 1, wait opcache.revalidate_freq seconds. The manual default is 2. Also purge any HTML cache.
How do I clear PHP OPcache?
On a VPS, restart PHP-FPM or the LiteSpeed PHP process for that version. On cPanel, keep validate_timestamps at 1 so edits expire on their own. If opcache_reset() is disabled, email support@webji.services and ask for PHP on that account to be recycled.
Is PHP OPcache enabled by default on PHP 8?
The manual default for opcache.enable is 1, including on PHP 8. A host can still set it to 0 in the ini your domain loads. Read phpinfo for that domain instead of assuming the default.
Does PHP OPcache make WordPress faster?
It skips compiling PHP on repeat requests, so PHP-heavy pages use less CPU. It does not shrink images, store HTML, or speed up MySQL. A slow query stays slow.
What is opcache.interned_strings_buffer?
It is the megabytes OPcache reserves for interned strings. The manual default is 8. The maximum is 32767 on 64-bit builds and 4095 on 32-bit builds. Before PHP 8.4 the maximum was 4095 on every build.

