How to flush the PHP OPcache

Flush the PHP OPcache with tscli opcache clear after deploying changed code on TurboStack, and what to expect afterwards.

PHP's OPcache stores compiled PHP as bytecode in memory so it does not recompile your code on every request. That speeds up the site, but it also means that after you change PHP files the cache can keep serving the old code until it is refreshed.

Flush it with the TurboStack CLI

Connect over SSH and run:

tscli opcache clear

This resets the OPcache for the site's PHP-FPM, so the next requests recompile from your current files.

When you need it

  • After deploying or editing PHP files outside the normal publish flow, when your changes do not show up.

  • On sites tuned for production, where OPcache does not re-check file timestamps on every request (validate_timestamps off) for maximum performance - there, a flush is required to pick up new code.