php / php/php-src

PHP checks the filesystem for file existing even if available in opcache and all opcache validations are disabled

Open
#13,989 30 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: opcache Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.2k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

opcache.enable = 1
opcache.enable_cli = 1

opcache.file_update_protection = 0
opcache.validate_timestamps = 0
opcache.validate_permission = 0
opcache.validate_root = 0

opcache.file_cache = "/var/cache/opcache"
opcache.file_cache_only = 1
opcache.file_cache_consistency_checks = 0

will still trigger "File doesn't exist" even though opcache is correctly prepopulated. If I create an empty folder with an empty file, it works as expected.

See (reproduced in Docker, but this is not Docker specific, it's only convenient to reproduce there):
https://github.com/dkarlovi/docker-php-opcache-only/blob/main/Dockerfile#L15

Try it like here:
https://github.com/dkarlovi/docker-php-opcache-only/blob/main/README.md

PHP Version

PHP 8.2, 8.3

Operating System

Docker PHP image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the Dockerfile at the linked line and the commands in the linked README. Trace why PHP reports "File doesn't exist" despite the prepopulated opcache and disabled validations. Done means the reproduced setup can load the cached file without requiring an empty filesystem file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.