I'm using a standard script to read the contents of a file like so:
$filename = "/usr/local/something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
Unfortunately "filesize ($filename)" kept returning 0 even though I knew the file was longer, and after running the script the filesize had been reduced to 0. So I replaced "filesize ($filename)" with an integer like so
$filename = "/usr/local/something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, 4096);
fclose ($fd);
...and now the file gets truncated to 4096 bytes. Does anyone know what in doug's name is going on?
I should mention that this script used to work perfectly on my system, the only possibly relevant, recent change I can think of that is that we upgraded from the old version of Debian to the latest (2.2r5).