What happens if a PHP script wants to:
file_put_contents("testfile", $s, FILE_APPEND | LOCK_EX);
while another script already does the same thing on the same file (with a LOCK_EX
too)?
It's unlikely to happen that 2 scripts want to write exactly during the same millisecond (for a < 100 kB file), but let's imagine it happens.
Would the file_put_contents
function notice it's locked, wait for say 10ms and then retry, or would the PHP script fail, and the data to be written is lost?