Title: PHP Warning: filesize(): stat failed
Last modified: February 24, 2022

---

# PHP Warning: filesize(): stat failed

 *  [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/)
 * Occasionally in PHP log seeing entries similar to this:
 *     ```
       [Feb 24, 17:10:48] PHP Warning:  filesize(): stat failed for /home/www/wp-content/cache/supercache/www.website.com/somelink/15266319706217ae08386910.65424059.tmp in /home/www/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 2331
       [Feb 24, 17:10:48] PHP Warning:  filesize(): stat failed for /home/www/wp-content/cache/supercache/www.website.com/somelink/15266319706217ae08386910.65424059.tmp.gz in /home/www/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 2345
       ```
   
 * Wondering what might be the cause of this? Race condition?
 * Using Cache Delivery Method: Expert.

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15492138)
 * I don’t think it’s a race condition but the files should have been created before
   the filesize() check is made. I don’t think it’s anything to worry about but 
   some pages may not be cached on your site, sometimes.
 *  Thread Starter [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15498411)
 * But seeing hundreds of these messages every day?
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15499731)
 * That is a problem. I’m pretty sure it’s not a problem with the plugin. Has your
   server been shut down expectantly recently? If it’s a Linux server you might 
   want to run e2fsck on the filesystem to make sure files are created correctly.
 *  Thread Starter [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15501713)
 * There was no unexpected shutdown of the server.
 * efsck shows file system is clean.
 * The only non-standard thing on the server is that one of the plugins clears WP
   Super Cache on request, using the following code:
 *     ```
       $cache_dir_path = get_supercache_dir();
       prune_super_cache( $cache_dir_path . 'index.html', true );
       prune_super_cache( $cache_dir_path . 'index.html.gz', true );
       ```
   
 * Not sure is that related.
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15502139)
 * It shouldn’t interfere but if you’re only deleting one file you should probably
   use unlink() instead:
 *     ```
       unlink( $cache_dir_path . 'index.html' );
       unlink( $cache_dir_path . 'index.html.gz' );
       ```
   
 *  Thread Starter [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15502270)
 * Not deleting the single page from cache, but need to delete complete cache.
 * Regarding “filesize(): stat failed” warnings, it seems we are not checking if
   the file exists before checking its size:
    [https://stackoverflow.com/a/34753479/5204858](https://stackoverflow.com/a/34753479/5204858)
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15502302)
 * Ah, that’s it then. You’re deleting the entire cache right at the same time a
   cached page is being created. Your cache must be getting destroyed quite often
   if you see this error regularly.
 * I’m aware the plugin isn’t checking if the file exists, the warning you’re seeing
   is happening while we create a new page. There’s no way to get to that code without
   the temporary cache file existing. Unless of course you’re blowing away the cache
   on a regular basis in another process. 🙂
 * I’ll put an “@” in front of it and suppress the error message. Those cache files
   aren’t getting created anyway.
 *  Thread Starter [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15502476)
 * This is 24-hour span:
 *     ```
       [27-Mar-2022 04:58:44 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 04:58:44 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:31:15 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:31:15 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:34:34 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:34:34 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:40:32 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 06:40:32 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:04:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:04:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:04:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:04:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:07:13 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:07:13 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:16:36 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:16:36 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:34:37 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:34:37 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:58:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 07:58:29 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 08:10:30 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 08:10:30 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:05:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:05:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:06:02 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:06:02 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:17:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:17:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:28:25 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:28:25 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:50:22 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:50:22 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:58:13 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 09:58:13 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 10:16:12 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 10:16:12 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 11:36:02 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 11:36:02 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:04:31 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:04:31 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:13:59 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:13:59 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:50:55 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 12:50:55 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:34:32 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:34:32 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:35:16 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:35:16 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:37:17 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 13:37:17 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 14:32:17 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 14:32:17 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 14:58:10 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 14:58:10 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:23:03 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:23:03 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:23:03 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:23:03 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:40:31 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:40:31 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 15:46:39 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:14:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:14:01 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:17:59 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:17:59 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:44:04 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:44:04 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:50:14 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 17:50:14 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 18:04:37 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 18:04:37 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 18:42:23 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 18:42:23 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 19:46:42 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 19:46:42 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 21:57:46 UTC] PHP Warning:  filesize(): stat failed
       [27-Mar-2022 21:57:46 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 02:43:56 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 02:43:56 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:43:32 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:43:32 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:46:48 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:46:48 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:46:51 UTC] PHP Warning:  filesize(): stat failed
       [28-Mar-2022 04:46:51 UTC] PHP Warning:  filesize(): stat failed
       ```
   
 * Since we do use official prune_super_cache() function to destroy cache, this 
   is actually a race condition 😉
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15521323)
 * In [https://github.com/Automattic/wp-super-cache/pull/814](https://github.com/Automattic/wp-super-cache/pull/814)
   I hid those warnings so you won’t see this message after the next release. Thanks
   for the report!
 *  Thread Starter [net](https://wordpress.org/support/users/krstarica/)
 * (@krstarica)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15544757)
 * Many thanks [@donncha](https://wordpress.org/support/users/donncha/)

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘PHP Warning: filesize(): stat failed’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [net](https://wordpress.org/support/users/krstarica/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/php-warning-filesize-stat-failed-2/#post-15544757)
 * Status: not resolved