Is manually clearing the cache folder contents safe?


I’m trying to debug a possible permissions issues on IIS / Server 2012 R2,

It appears that only some of the contents of the cache folder are stuck and for whatever reason the site crashes trying to update the cache folder contents. I suspect the problem isn’t reading from the cache, but over-writing files that are already in the cache.

Also I note I have tried enabling Dev mode but the system still tries to write to the cache folder, so I presume that Dev mode only disables reads from the cache folder and still allows writes to it.

I’ve tried using various Admin/Repair options to clear the cache and rebuild the relationships but some stuck files remain. It may be that the there is a corruption in the folder tree, or even the HDD, I note that the actual files that appear stuck vary each time I relaunch the website. I do know there were some MS updates rolled out 24hrs before these problems started, but regardless I still have to solve the issue.

As a diagnosis option is it safe to take the site down and manually clear the contents of the cache folder?


In Windows, I would use Sysinternals’ Process Explorer to check the handles and see which process might be using (and thus, locking) the files. It could be your anti-virus.

1 Like

Hi PGR, thanks for the advice.

It looks like the problem is a PHP version sensitve false positive from the anti-virus.

The site is running 7.10.36 under PHP 5.6, prior to attempting an upgrade to 7.12.6 we need to upgrade PHP, we picked 7.4 as the latest version 7.10.36 supports, but it looks like our security software then flags PHP 7.4 altering the contents of the cache folder as a suspicious activity and winds back any changes to the cache.

Why it does that for PHP 7.4 and not for PHP 5.6 is a bit of a mystery, I’ll probably now have to test a few different PHP versions to see if it’s version specific!

1 Like

We usually do this and it never broke anything

$ rm -r cache