There is a problem with W3 Total Cache in some cases when a large file needs to be downloaded through a PHP file that loads WP. If the file is small (under 20 MB) everything is OK, but with larger file it fails, and browser gets empty file in the end. Server logs a very strange error:
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 91626332 bytes) in .../wp-content/plugins/w3-total-cache/inc/define.php on line 233
My download script sets memory to 256M, and file that needs downloading is 91626332 bytes. And line 233 is a function that tries to determine is file is XML by reading whole file to find first 4-5 characters (string functions in PHP work that way). How that was called in the first place is a mystery.
My download script loads wp-config, and set's header elements and uses readfile, and that fails every time. Disabling W3, and this works just fine. Even if all cache methods in W3 are disabled problem is still there, as long as W3 plugin is activated. Script is in the WP plugins folder.
How can I force W3 not to mess with the process of loading of this script or some other page maybe?