title: How to lock a directory for exclusive access in PHP on Windows?
body: <p>I'm using the <a href="http://php.net/manual/en/function.flock.php" rel="nofollow">flock()</a> method to get an advisory lock on a directory, and prevent another process from accessing the same directory at the same time. Because <code>flock()</code> operates on a file handle, I have to open a handle on the directory first:</p>
  
  <pre class="lang-php prettyprint-override"><code>fopen('.', 'r');
  </code></pre>
  
  <p>However, this does not work on Windows:</p>
  
  <blockquote>
    <p>fopen(.): failed to open stream: Permission denied</p>
  </blockquote>
  
  <p>Is there a way to do the same on Windows, or is it a limitation of this platform?</p>