To get the most out of OPCache, you should disable it opcache.validate_timestamps. If you subsequently call opcache_reset()from the script each time you deploy your code on the server, your OPCache is flushed once for each new set of files, and the system does not waste resources constantly checking files.
There are a couple of "gotchas" there:
First of all, make sure that the call opcache_reset()occurs, otherwise you will run the old code. If you have a script to perform the deployment, make sure that it does not work out loud if this step is not performed.
-, , PHP (mod_php vs php-fpm), opcache_reset() , . , PHP, ,
<?php
if (php_sapi() != "cli") die("Not accessible from web");
opcache_clear();
. PHP , , , -.
, script curl wget. , curl http://example.com/clear_cache.php?secret=abc123. script , , , - , .
, , , , , .zip , , , , git pull . , git pull && composer update . , , , , .