In the documentation is written:
"If you don't want flock() to block while locking, add 4 to operation. "
Does it mean that I must use:
$fd=fopen($filename,"w+") or die("Can't open $filename");
flock($fd, 2);
$written4=fwrite($fd,$data);
flock($fd, 4);
fclose($fd);
instead of
$fd=fopen($filename,"w+") or die("Can't open $filename");
flock($fd, 2);
$written4=fwrite($fd,$data);
flock($fd, 3);
fclose($fd);
And must I lock files that I open only for reading with fread($fd,filesize($filename))?
Thank you
vlad