How to forcibly completely clear PHP7 opcache?

The opcache on my webserver keeps hitting the limit I have set even though I feel like I don't have that much PHP code and it really ought to be enough room.

This is compounded by the fact that even when clearing the opcache, it immediately shows over 2/3 of the available space as being filled.

Example from just now:

phpinfo snippet just before running opcache_reset():

Used memory     122958472
Free memory     5552 

phpinfo snippet just after running opcache_reset():

Used memory     90691312
Free memory     43526416

I know that in PHP7, the opcache is (apparently) backed up to disk, so maybe stuff is being auto-reloaded? But that seems to defeat the purpose of resetting the opcache and I have no idea where on disk the opcache is backed up to, so I can't check.

I'm running PHP-FPM on nginx, vesion 7.0.15-0ubuntu0.16.04.4 to be precise.


You have to use opcache_reset(), http://php.net/manual/en/function.opcache-reset.php

Note that it doesn't work over CLI; you have to create an HTTP-accessed script that calls it.