Clear opcache in PHP

If you are working on a shared environment and deleted PHP files keep around, check how to clear empty the cache…
In this case we found the server used “opcache” so with the function opcache_reset() we can get rid of the cache…

If you don’t have shell access, simply create a PHP file like this: clearcache.php
And add this code:

opcache_reset();

Run it! and you are ready :)

References:
https://www.php.net/manual/en/function.opcache-reset.php

AC

This entry was posted in Linux, Medium Technical and tagged , , , , , . Bookmark the permalink.

Comments are closed.