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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:55:16+00:00 2026-06-18T00:55:16+00:00

I was curious if ../ and /../ is the same in PHP so I

  • 0

I was curious if ../ and /../ is the same in PHP so I tried these:

require_once('/../frame/header.php');
require_once('../frame/header.php');

Both of them worked. Was I just lucky or they realy do the same exact thing? Why?

  • 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-18T00:55:17+00:00Added an answer on June 18, 2026 at 12:55 am

    In your context if they both worked, that implies that your scripts are at the root of the filesystem you have access to, or one level in. They are not the same however! /../ refers to the filesystem root (and .. one directory up, which just gets eaten and is still the root), while ../ refers to one directory higher than the current one. Any path beginning with / is an absolute path from the filesystem root.

    From anywhere other than the filesystem root, these would not function equivalently.

    Suppose your working directory is /var/www/scripts.

    require_once('../include.php');
    

    Will include a file at /var/www/include.php.

    But from that same location, if you did

    require_once('/../include.php');
    

    …php will attempt to load the file /include.php at the filesystem root, and it probably won’t exist.

    Now, a lot of web hosts will supply you with a filesystem whose root / is also the web server’s document root, the web server document root is only one directory level in from the root like /www. In that case, /../ may work fine, but beware if you ever attempt to move it to another server with a different filesystem configuration.

    So if the script’s working directory was /www, just by luck, these two would function the same way:

    require_once('../include.php');
    require_once('/../include.php');
    

    Both would include the file /include.php at the filesystem root.

    Note, this is not PHP-specific, but a property of filesystems which use the .. in general…

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

Sidebar

Related Questions

I just curious about updating mysql table record (in connection with php) as follows.
I'm curious about using two APIs that both utilize OAuth2 authentication in the same
Just curious. If I have 2 threads spawn using forkIO , communication between them
I am just starting php. I am just curious if there is a better
I am curious to see if anyone else has run into this same issue...
Just curious, is there a format string I can use to output something like
I'm just curious and was wondering how you guys handle it if you want
I am curious whether packing multiple and/or nested method calls within the same line
Curious as to how to approach this same problem using ruby / rails -
I am pretty new to using object/classes in PHP and I am curious about

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.