RE: [PHP] periodic file writing error (fputs)
| From: | Jay Blanchard | Date: | Thu, 05 Aug 2004 18:00:48 +0000 |
| Subject: | RE: [PHP] periodic file writing error (fputs) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192919@lists.php.net to get a copy of this message | ||
[snip]
I am having a periodic problem that I cannot duplicate and wonder if
anyone has suggestions.
Once a sale is completed a record is written to a log file on the
server.
$filename = $dir. "/". $logType."_".$today.".txt";
$fp = fopen("$filename", "a+");
fputs($fp, $logEntryStr);
fclose($fp);
The file is chmoded to 644.
About 3 out of 600 times, the log file is not written to. The times
of day this happens are not consistent, and as I mentioned, I cannot
duplicate it when testing. I initially thought it was some kind of
error on the server, but I am beginning to think it is in my code.
Has anyone experienced anything like this or have any suggestions for
how to troubleshoot this?
[/snip]
How do you know that it is not being written to? Do the transactions
show up in a database or some other form? Is it possible to have
duplicate log entries? What is $today, a date stamp, time date stamp,
epoch time stamp?