PHP error guide
OPcache file cache permission denied: meaning and fix
Error summary
Create a dedicated writable opcache.file_cache directory or disable that optional cache for this pool. OPcache cannot read or create metadata in its configured file cache path.
What it means
Create a dedicated writable opcache.file_cache directory or disable that optional cache for this pool. OPcache cannot read or create metadata in its configured file cache path.
What the error means
This message means that OPcache cannot read or create metadata in its configured file cache path. The exact signature distinguishes opcache file cache permission denied from a generic application failure.
Why PHP produces it
The engine or service reports “OPcache file cache permission denied” because its required precondition was not met. Create a dedicated writable opcache.file_cache directory or disable that optional cache for this pool.
PHP version notes
The opcache file cache permission denied wording here is based on PHP 7.x–8.4; punctuation and exception class names can differ on older branches or vendor builds.
Most common causes
- The immediate input or configuration reaches the specific condition: OPcache cannot read or create metadata in its configured file cache path
- The code path assumes the prerequisite for opcache file cache permission denied has already been satisfied.
- For opcache file cache permission denied, development and production differ in version, extension, permissions, paths, or service configuration.
- An earlier operation returned an unchecked value that is consumed by the line reporting opcache file cache permission denied.
Minimal examples
BAD — reproduces the problem
opcache.file_cache=/root/opcache
FIXED — safer pattern
opcache.file_cache=/var/cache/php/app-opcache
Step-by-step diagnosis
- Copy the complete “Fatal Error Unable to open base address file” text and retain the first application stack frame.
- Reproduce opcache file cache permission denied in the same SAPI and environment listed for this page.
- Before changing opcache file cache permission denied, inspect the preceding value or directive and verify its type, path, version, and permissions.
- Apply the narrow correction—create a dedicated writable opcache.file_cache directory or disable that optional cache for this pool—then repeat the original request once.
Fixes
Correct the failing prerequisite
Create a dedicated writable opcache.file_cache directory or disable that optional cache for this pool
opcache.file_cache=/var/cache/php/app-opcache
Fail explicitly at the boundary
Validate the condition before the operation that emits opcache file cache permission denied, and log a safe diagnostic without credentials or full production paths.
Common mistakes when fixing it
- Suppressing opcache file cache permission denied instead of correcting its upstream condition.
- Testing opcache file cache permission denied only with the CLI binary when the failing request runs under FPM or Apache.
- Changing a global setting for opcache file cache permission denied before confirming the site-specific effective configuration.
How to prevent it
- Add a focused test that exercises the boundary responsible for opcache file cache permission denied.
- Keep runtime versions, extensions, configuration, and deploy artifacts affecting opcache file cache permission denied reproducible.
- Validate external data and service return values before they can trigger opcache file cache permission denied.
Web server / environment notes
fpm, apache, linux, shared-hosting. The failure occurs where oPcache cannot read or create metadata in its configured file cache path
Tags: fpm,apache,linux,shared-hosting