title: php file_put_contents no such file or directory occasionally
body: <p>I start 8 processes to execute a job, the code in the job like this:</p>
  <pre><code>&lt;?php
  $dir = &quot;/home/test/fileputcontents/0&quot;;
  if(! is_dir($dir)){
      mkdir($dir, 0755, true);
  }
  file_put_contents(&quot;{$dir}/0.txt&quot;, &quot;aaaa\n&quot;, FILE_APPEND | LOCK_EX);
  </code></pre>
  <p>but it raises an error which say &quot;No such file or directory&quot; sometimes，not very offen, thanks very much.</p>
  <p>Is it because php_mkdir_ex method? Multi-process create directory at the same time.</p>
  <pre><code>/* DEPRECATED APIs: Use php_stream_mkdir() instead */
  PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options)
  {
      int ret;
  
      if (php_check_open_basedir(dir)) {
          return -1;
      }
  
      if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) &lt; 0 &amp;&amp; (options &amp; REPORT_ERRORS)) {
          php_error_docref(NULL, E_WARNING, &quot;%s&quot;, strerror(errno));
      }
  
      return ret;
  }
  </code></pre>