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

  • SEARCH
  • Home
  • 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 6087803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:54:43+00:00 2026-05-23T11:54:43+00:00

I am using mkdir in a php script to make file3 in directory /file/file2/file3

  • 0

I am using mkdir in a php script to make file3 in directory /file/file2/file3. I use permission 777 but the file always looks like dr----x--t 2 admin admin 4096 Jul 1 19:26 file3 once it is made. I am running Centos 5 64bit. file2 is permission drwxrwxrwx 16 root root 4096 Jul 1 19:26 file2 already. Anyone have any ideas why this is?

mkdir("/file1/file2/file3",777);
  • 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-05-23T11:54:44+00:00Added an answer on May 23, 2026 at 11:54 am

    You want to use 777 octal, not decimal:

    mkdir ("/file1/file2/file3", 0777);
    

    777 decimal turns out to be 1411 octal which will give you the bitmask 1 100 001 001 which is why you’re getting those “strange” permissions. The standard set (last three segments) gives you r----x--x and the first segment modifies the world permissions to t (the sticky bit).

    Also keep in mind that mkdir is subject to your umask setting and may not give you the permissions you ask for (your umask setting gets “removed” from the permissions you ask for to give you the actual permissions). See here for details, including how to avoid the problem.

    You’re better off using mkdir to create the directory then chmod (which isn’t affected by your umask setting) to change the permissions.

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

Sidebar

Related Questions

I am using the PHP function mkdir($path, 0777) to create a new directory on
I am trying to create a directory using mkdir function in PHP. It works
I am using the following code in WINDOWS OS and PHP script, in which
I want to create a directory on windows from a PHP script. My script
I have a PHP script that processes file uploads. The script tries to organise
I am using PHP to create a directory. After the directory is created it
I can't use mkdir to create folders with UTF-8 characters: <?php $dir_name = Depósito;
I've been trying to get a script to work that calls a PHP file
I have created folders using PHP's mkdir command. Now I want to delete these
I am trying to deploy a PHP application using subversion and post-commit script. I've

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.