W3TC white page

W3TC – W3 Total Cache  white page when deleting page cache

For the last two weeks i had a strange issue when trying to clear/delete the W3 Total Cache page cache. Whenever there was an update to a plugin i used W3TC came up with a message about emptying the page cache and checking the minify settings. This wasn’t a problem, i clicked the button and the page cache got emptied, until two weeks ago when, all of a sudden, i saw the default 404 error page or a white page when trying to empty the page cache. At first i thought it’d be some glitch in the server setup, so i went and checked PHP and MySQL settings, had a look at all error logs that could be remotely relevant but nothing suspicious showed up in them.

So i tried to ignore this minor annoyance which worked fine until yesterday. I updated a plugin used on this site, W3TC came up with the warning message about emptying the page cache and checking minify settings again, i clicked the “Empty Page Cache” button and guess what? Exactly, 404 error message again. And again i went through all log files, checked MySQL, PHP and Apache again just to find nothing that would help troubleshooting this further. Left WordPress and W3TC alone for a bit, then ssh’ed back into my server to have another look and checked, just out of curiosity, the wp-content/cache folder.

Sizewise i was kinda shocked when i saw the the wp-content/cache folder had a size of roughly 800M and contained about 23.000 files and about the same amount of directories. If you would like to know how i figured that, then here is the script i used to count files and directories (this code will also count symbolic links):

With that many files and directories to delete it became clear that PHP at some point had hit the max_execution_time which in turn caused the page to go blank, respectively show the default 404 error page. And since i couldn’t solve this from within WordPress i had to use rm to get rid of the directories/files. After all old cached files/directories were deleted i tried deleting the page cache from within WordPress/W3TC again and it worked flawless.

So, if your W3 Total Cache (W3TC) ends up with a white page or a 404 error page when trying to delete the page cache then it’s worth checking the size/amount of files in your wp-content/cache directory and delete them manually. You can do that by either using SSH and rm or, if no SSH access is possible, using a FTP client like FileZilla to delete the directories and files.

Be the first to comment

Leave a Reply

Your email address will not be published.

I confirm