opcache_reset

Opcache_reset function is used to clear the PHP Opcache memory. Since the server is running a PHP CGI runtime, the function only clears the memory of one specific PHP process. Occasionally, there may be situations where it is necessary to clear the Opcache cache of all PHP processes.

To clear the cache of all PHP processes, you must first access the server via SSH.

You then need to look at the user’s PHP processes using ps aux.
PHP processes are named phpXX-cgi, where XX stands for the PHP version.

Now you have to eliminate all the PHP processes that you would like to, you can do this by using the killallcommand.
Example: killall php73-cgi eliminates all of PHP 7.3 processes.

Killing all existing PHP CGI processes also flushes the opcache.

Updated on 19. Apr 2024

Was this article helpful?

Related Articles