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 6533051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:04:42+00:00 2026-05-25T10:04:42+00:00

I want to go up two directories from the current working directory. I used

  • 0

I want to go up two directories from the current working directory.

I used chdir("..") two times to make the move. And after that I call mkdir("directoryname") ; but when I looked at the operating system ( Linux Ubuntu ) then the directory is not created ; even though I already set the chmod 777 to the parent directory into which I want to create the new directory. So how to mount up two directories level with PHP ?

  • 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-25T10:04:42+00:00Added an answer on May 25, 2026 at 10:04 am

    Verify “where” your script started and where it is after the two chdir()s via

    echo getcwd();
    

    also test the return value of mkdir

    if ( mkdir($path) ) {
      echo 'done'.
    }
    else {
      echo 'failed.';
    }
    

    or use getcwd() or _FILE_, _DIR_ (or whatever is suitable) and dirname() to create an abosulte path for mkdir()

    $d = getcwd();
    echo 'start: ', $d, "\n";
    $d = dirname(dirname($d));
    echo 'target: ', $d, "\n";
    
    $d .= '/directoryname';
    echo 'creating ', $d, "\n";
    if ( mkdir($d) ) {
        echo 'done.';
    }
    else {
        echo 'failed.';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a script that compares two directories. However, the file names
I have a directory with 4 directories in it. I want to make a
I need to access files from two directories in the same directory in a
I want to use rsync to synchronize two directories in both directions. I refer
I want two special methods: one that runs for all URLs one that runs
there are two directories C:\a\b C:\a\c well iam in say directory c:\a\b when i
I want to write two different types of output from the same reducer, into
I am coding a class that compares the files of two directories via comparing
I have two directories ( dirA and dirB ), and i want to copy
Suppose we want two constructors for a class representing complex numbers: Complex (double re,

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.