Put OPcache settings in a file of your own and reload FPM, since the shared memory is sized once, when the master starts. A production starting point:
opcache.memory_consumption = 256 ; MB of shared memory (default 128)
opcache.interned_strings_buffer = 16 ; MB, carved out of the above (default 8)
opcache.max_accelerated_files = 20000 ; slots for scripts (default 10000)
opcache.validate_timestamps = 0 ; never stat files; reload FPM on deployWith validate_timestamps=1 (the default), OPcache checks each file's modification time at most every revalidate_freq seconds (default 2) and recompiles changed files. On the Laravel 2,157 page the defaults gave 1,406 requests per second; revalidate_freq=0, a check on every request, gave 1,050 (25% slower, fine on a development box only); validate_timestamps=0 gave 1,449. The last is 3% faster, but OPcache then serves old code until you reset it:
$ echo '<?php echo "version 1\n";' > version.php; sleep 3; curl -s localhost/version.php version 1 $ echo '<?php echo "version 2\n";' > version.php; sleep 3; curl -s localhost/version.php version 1 $ sudo systemctl reload php8.5-fpm; curl -s localhost/version.php version 2
The sleep matters: opcache.file_update_protection (2 s) will not cache a file younger than that. The reload sends the master SIGUSR2, restarting the workers with an empty cache. opcache_reset() from a terminal clears only the CLI's own cache.