solvit.io

Clear the PHP OPcache contents

Solution #1
  1. Create a PHP file with this content:
    <?php opcache_reset();
    
  2. Load this PHP file via your web server
Note: This technique doesn't work in the command console, so you cannot execute php -r "opcache_reset();" in your terminal to delete OPcache contents.
Solution #2

Reload the PHP module/daemon used by the web server and the OPcache contents will be deleted:

# when using mod_php and Apache
$ apachectl graceful

# when using PHP-FPM
$ service php-fpm reload
Find more solutions about: , ,