title: Why mkdir fails with recursive option set true?
body: <p>I run the following code:</p>
  
  <pre><code>mkdir('mnt/1',0777,true);
  mkdir('mnt/a',0777);
  </code></pre>
  
  <p>Directory "a" is created, while directory "1" is not, page prints warning.</p>
  
  <pre><code>Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 3
  </code></pre>
  
  <p>I have full permissions on directory mnt for user apache is running:</p>
  
  <pre><code>drwxr-xr-x 1 bitrix bitrix   4096 Nov 28 10:10 mnt
  </code></pre>
  
  <p>PHP version - PHP 5.3.3. Apache version 2.2.15.</p>
  
  <p>Any ideas, why mkdir fails with recursive option set to true? </p>
  
  <p><strong>Update!</strong>
  Well I cleared the folder, made the following php-script and ran it again:</p>
  
  <pre><code>&lt;?php
          error_reporting(E_ALL);
          mkdir('mnt/1',0777,true);
          mkdir('mnt/2/',0777,true);
          mkdir('./mnt/3',0777,true);
          mkdir('./mnt/4/',0777,true);
  
          mkdir('mnt/a',0777);
          mkdir('mnt/b/',0777);
          mkdir('./mnt/c',0777);
          mkdir('./mnt/d/',0777);
  ?&gt;
  </code></pre>
  
  <p>Here is the output:</p>
  
  <pre><code>Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 3 
  Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 4 
  Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 5 
  Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 6
  </code></pre>
  
  <p>Here is the content of the folder mnt after script execution:</p>
  
  <pre><code>drwxr-xr-x  1 bitrix bitrix  4096 Nov 28  2012 .
  drwxrwx--- 11 bitrix bitrix 12288 Nov 28 11:10 ..
  drwxr-xr-x  1 bitrix bitrix     0 Nov 28  2012 a
  drwxr-xr-x  1 bitrix bitrix     0 Nov 28  2012 b
  drwxr-xr-x  1 bitrix bitrix     0 Nov 28  2012 c
  drwxr-xr-x  1 bitrix bitrix     0 Nov 28  2012 d
  </code></pre>
  
  <p>I also tried absolute path for recursive mkdir - still no luck, while non-recursive mkdir works fine no matter how the path is set. What's wrong with recursive mkdir? I still have no ideas..</p>
  
  <p><strong>Update!</strong> Further investigation revealed that such things happen because mnt is a folder, mounted by command</p>
  
  <pre><code>mount -t cifs -o username=***user***,password=***password***,uid=bitrix,gid=bitrix,iocharset=utf8,codepage=866 //192.168.1.6/folder /home/bitrix/www/mnt
  </code></pre>
  
  <p>In all other directories recursive mkdir works fine, while in that directory only non-recursive mkdir works!</p>
  
  <p><strong>Update!</strong> As <strong>femtoRgon</strong> assumed mkdir, when run from script in the folder <code>mnt</code>, works fine both recursive and non-recursive. But still I can't figure out, why it fails, when run from /home/bitrix/www? I even tried mounting with options <code>file_mode=0775,dir_mode=0775</code> - no luck. My OS = CentOS 6.3, if it matters..</p>