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

The Archive Base Latest Questions

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

I have a file which name is load.php near index.php in root folder. So

  • 0

I have a file which name is load.php near index.php in root folder. So i only have two files in root. I like clear works like most.

Today i needed to define directories in one file name is define.php. But it is not in root, i’ve added it to settings folder in root folder.

So my files:

  • index.php (requires load.php)
  • load.php (requires settings/define.php)
  • settings (includes define.php)

Now i don’t know how to get root folders name?

__DIR__ in define.php gives me …/home/settings folder but i want to get root or another folders name. So what is the way?

  • 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-25T11:55:05+00:00Added an answer on May 25, 2026 at 11:55 am

    To find out the “root” directory from inside settings/define.php, this should be sufficient:

    $root = realpath(__DIR__.DIRECTORY_SEPARATOR.'..');
    

    See it in action.

    Note: the linked example uses dirname(__FILE__) instead of __DIR__ because the latter is only available on PHP >= 5.3, but is functionally equivalent.

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

Sidebar

Related Questions

I have a php script whose name is XYZ.php. When I load that file
I have a file name logspath.txt which contain on the logs directory path on
I have a HTML file upload field from which I'm reading the file name
I have a variable which has the directory path, along with the file name.
I have one file in my project, (the readme file,) which I would like
I have a file input element which generate by ajax/jquery.load(). and when I want
I have a file which is an XML representation of some data that is
I have a file which has multiple columns, whitespace separated. e.g: data1 data2 data3
I have .zip file which contain csv data. I am reading .zip file using
Assume you have a file which has been committed in your Git repo. You

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.