Even from OPcache, each request must link the classes it uses. Preloading (PHP 7.4) runs a script named by opcache.preload once, when the FPM master starts; every class and function it compiles stays linked and present in every request without autoloading, and cannot change until FPM restarts. It is not supported on Windows. Preload what the site uses: after a warm-up request, a throwaway script wrote the 495 paths in opcache_get_status(true)['scripts'] to preload-list.php, and this file preloads the vendor ones:
<?php
// opcache.preload runs this once, as the FPM master starts
require __DIR__ . '/vendor/autoload.php'; // also runs Composer's "files" entries
$loaded = array_flip(get_included_files());
$compiled = 0;
foreach (require __DIR__ . '/preload-list.php' as $file) {
if (!isset($loaded[$file]) && str_contains($file, '/vendor/')) { // app code: reloadable
$compiled += (int) opcache_compile_file($file);
}
}
error_log("preloaded $compiled files");With opcache.preload=/var/www/shop/preload.php (plus opcache.preload_user=www-data, since the systemd 142,543 master runs as root), the FPM log and opcache_get_status()['preload_statistics'] showed:
[23-Sep-2026 17:14:43] NOTICE: PHP message: preloaded 424 files preload memory 11.4 MB, 479 scripts, 447 classes, 430 functions
Throughput rose from 1,456 to 1,628 requests per second (12%), and 15% in a second session. The log also held 27 Can't preload unlinked class warnings for classes whose parent was not yet compiled; they stay unpreloaded. Without the get_included_files() check, compiling Composer 5,243 's helper files again died with Cannot redeclare.