Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:38:53+00:00 2026-06-15T04:38:53+00:00

I run the following code: mkdir(‘mnt/1’,0777,true); mkdir(‘mnt/a’,0777); Directory a is created, while directory 1

  • 0

I run the following code:

mkdir('mnt/1',0777,true);
mkdir('mnt/a',0777);

Directory “a” is created, while directory “1” is not, page prints warning.

Warning: mkdir(): File exists in /home/bitrix/www/php_test.php on line 3

I have full permissions on directory mnt for user apache is running:

drwxr-xr-x 1 bitrix bitrix   4096 Nov 28 10:10 mnt

PHP version – PHP 5.3.3. Apache version 2.2.15.

Any ideas, why mkdir fails with recursive option set to true?

Update!
Well I cleared the folder, made the following php-script and ran it again:

<?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);
?>

Here is the output:

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

Here is the content of the folder mnt after script execution:

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

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..

Update! Further investigation revealed that such things happen because mnt is a folder, mounted by command

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

In all other directories recursive mkdir works fine, while in that directory only non-recursive mkdir works!

Update! As femtoRgon assumed mkdir, when run from script in the folder mnt, 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 file_mode=0775,dir_mode=0775 – no luck. My OS = CentOS 6.3, if it matters..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:38:54+00:00Added an answer on June 15, 2026 at 4:38 am

    After some googling, I found the answer on php.net. It is all about serverino mount option. When I mounted folder with noserverino all problems were gone. Anyway thanks guys for trying to help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I run the following code: $page = '<p>Ä</p>'; $DOM = new DOMDocument; $DOM->loadHTML($page); echo
When I run following code textblock is not changing. My guess is databinding is
when I trying to run following code. var result = from c in db.brand
I run the following code from command line: public class MemoryTest { public static
I run the following code on a Windows platform. The purpose is the know
When I run the following Code it crashes at the last line. I don't
When I run the following code I get B as expected: class A {
If I run the following code on my HTC magic phone I get a
When I run the following code: private void button1_Click(object sender, EventArgs e) { Bitmap
When I run the following code, I get the exception below: ''# NOTE: ExcelApp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.