PHP\'s documentation page for flock() indicates that it\'s not safe to use under IIS. If I can\'t rely on flock under all circumstances, is there another way I
I appreciate this question is a few years old but I kinda felt that a working example/replacement for flock might be worth building. I've based this on the other answers but for someone who is purely looking to replace the flock functionality (rather than write a file at the same time (although this does reflect the PHP manual flock example)) I believe the following will suffice
function my_flock ($path,$release = false){
if ($release){
@rmdir($path);
} else {
return !file_exists($path) && @mkdir($path);
}
}