Internet has a lot of discussions that calling apc_cache_clear()
in CLI does not clear opcode caches from "web" PHP processes, whether they are run inside Apache or by FPM (see How to clear APC cache entries? ). As a suggested solution, it's possible to create a simple PHP page that calls apc_cache_clear()
, and call that from CLI. Symfony's ApcBundle does that.
If the apc_cache_clear()
from CLI does not empty the cache from Apache/FPM, does it between FPM workers? If I call /clear_apc_cache.php over HTTP, it's run by only by one of the FPM worker processes. So, is the APC opcode cache really shared between pools and workers - and more specific: is it cleared from all workers automatically?
All the php-fpm workers share the same opcode cache as the parent php-fpm process; source. If you have a /apc_clear_cache.php file and you call that over HTTP (using something like curl), you will clear the opcode cache for all workers using the same php-fpm master process.
This blog article has a very good explanation of how apc works and how to clear it effectively during release.