In Unix it is possible to delete a file while it is opened - the inode will be kept until all processes have ended that have it in their file descriptor list While flock() is mandatory under Windows. Since it's mandatory under Windows, you can not write code like -------------------------------- $file = fopen(); flock(file,LOCK_EX); file_put_contents(); flock($file,LOCK_UN); fclose($file); -------------------------------- You can't write using file_put_contents after locked by flock ( it works on Unix but not Windows )