In А.php is executed
foreach($allUsers as $cnt=>$arUser){
shell_exec("nohup php /B.php $arUser > TestFile.log & echo $!");
}
in script B.php I write log
file_put_contents('Log.log', " action \r\n", FILE_APPEND | LOCK_EX);
But part of the data is not logged. This is most likely due to the file locking by another process. How to log correctly without losing data when multi-threaded writing to a single file?