[doc-en] master: opcache: Explain what opcache.use_cwd and opcache.revalidate_path do (#6118)
| From: | Asish Kumar via GitHub | Date: | Fri, 20 Nov 2026 08:10:25 +0000 |
| Subject: | [doc-en] master: opcache: Explain what opcache.use_cwd and opcache.revalidate_path do (#6118) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23986@lists.php.net to get a copy of this message | ||
Author: Asish Kumar (officialasishkumar)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-20T09:10:22+01:00
Commit: https://github.com/php/doc-en/commit/3feebd8c17479a0fd12d714bf7c19e12e2eacd12
Raw diff: https://github.com/php/doc-en/commit/3feebd8c17479a0fd12d714bf7c19e12e2eacd12.diff
opcache: Explain what opcache.use_cwd and opcache.revalidate_path do (#6118)
The descriptions of these two directives did not explain how they
interact, or what goes wrong when they are disabled, so they can look
like no-ops (#4583).
According to accel_make_persistent_key(), persistent_compile_file() and
persistent_zend_resolve_path() in ext/opcache/ZendAccelerator.c:
- opcache.use_cwd adds the current working directory, the include_path
and the directory of the including script to the key of a script
included with a relative path, not only the current working
directory. When disabled, the relative path alone is the key, so two
different files included as 'config.php' from two directories share
one cache entry. It has no effect on absolute paths, stream wrappers,
or when opcache.revalidate_path is enabled, because the key is then
not used for the lookup.
- With opcache.revalidate_path disabled, a script found by that key is
used without resolving the path again. That applies to a file added
earlier in the include_path (the only case documented so far), and
also to a symbolic link in the path that now points to another
directory. When enabled, the path is always resolved to the real path
first.
Checked with PHP 8.6.0 CLI (opcache.enable_cli=1 and
opcache.file_update_protection=0) for every combination of the two
directives.
Fixes #4583
Changed paths:
M reference/opcache/ini.xml
Diff: