However there's one thing I wonder about.
If someone else has locked the file, does [php_man]flock[/php_man] return false immediately, or does it wait for a predefined limit and then, if the file is still locked, return false.
If is is the former, should I be writing:
Code: Select all
$handle = fopen ("path/to/logfile.log", "w");
while (! flock ($handle, LOCK_EX))
;
fwrite ($handle, "Log-entry"); // etc.
flock ($handle, LOCK_UN);
fclose ($handle);