Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is created from #2290
The Github UI is stuck using that PR, so a new PR has been created.
https://a8c.slack.com/archives/C04BURZDHFH/p1753189537944499
Motivation for the change, related issues
Related to #2251
With this PR, we are adding support for OPCache by introducing a new
WITH_OPCACHE
argument,true
by default.Implementation details
The OPCache library is always compiled as a dynamic library. Once #2248 is merged, we can proceed to use the dynamic library generated instead of forcing a static compilation by patching
ext/opcache/config.m4
.Caching mechanism
The OPCache .m4 file performs a series of tests.
OPCACHE_FILE_CACHE
HUGE_CODE_PAGES
JIT
MPROTECT
SHM_IPC
SHM_MMAP_ANON
SHM_MMAP_ZERO
SHM_MMAP_POSIX
SHM_MMAP_FILE
In this PR, we force the Autoconf to recognize the
mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
emulated shared (anonymous) memory by renaminghave_shm_mmap_anon
(renamed tophp_cv_shm_mmap_anon
in PHP 8.4).Additional
Starting with Python 3.12, distutils was removed from the standard library after being deprecated in Python 3.10. Here, we force the last version to ensure that
node-gyp/gyp/gyp_main.py
does not crash during compilation because it does not find the module.Testing Instructions (or ideally a Blueprint)
First test
Open
phpinfo.php
and search for "Zend OPCache". It should be "Up and Running" and "OK" on startupSecond test
Try this blueprint (https://gist.github.com/zaerl/3e60bff32e1e915d5acc509bd50e9762). It will load WordPress +20 times so it will not open immediately.
"Cached" should be
true
, all the GET responses 200 OK. Theopcache_enabled
field will befalse
. It is a well-known PHPfeaturebug. Now openpackages/php-wasm/universal/src/lib/php.ts
and comment out these two lines:The same page will show more details and an hit rate ~75%. Now visit
wp-admin
, open some page. Go back toopcache.php
, it should show ~90% or better.