I have a simple PHP script that runs through Windows task scheduler each day. It reads a CSV file and sends me an email. I have noticed having changed the CSV file it is still processing the old version.
I assume the file is cached somewhere, but I have no idea where. Is there a way to ensure the script is using the current version of the CSV file?
“reads a CSV file” how are you reading it? Is it a local file read, or a web file read?
Local file reads shouldnt be cached.
Web file reads may be. The typical way to cache-bust these requests is to add a changing non-effective query string parameter, such as file_get_contents("sample.com/file.csv?cachebust=".time());
I was about to say yes, having checked again. Then I spotted that it was still pointing to my old localhost directory, and having changed from XAMPP to Laragon they have changed.