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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:35:18+00:00 2026-05-17T18:35:18+00:00

I use the following scheme to include PHP files: require($_SERVER[‘DOCUMENT_ROOT’] . Path/To/My/Website/Path/To/My/File.php); I would

  • 0

I use the following scheme to include PHP files:

require($_SERVER['DOCUMENT_ROOT'] . "Path/To/My/Website/Path/To/My/File.php");

I would like to save

$_SERVER['DOCUMENT_ROOT'] . 'Path/To/My/Website'

in some variable, say $my_website, and write:

require("$my_website/Path/To/My/File.php");

This way, if I decide to change the path to my website, I will need to modify it only in one place in my code.

Some PHP files may be included several times and from different directory levels. For example:

$_SERVER['DOCUMENT_ROOT']
                         Path
                             To
                               My
                                 Website
                                        Dir1
                                            a.php
                                        Dir2
                                            b.php that includes a.php
                                        Dir3
                                            Dir4
                                                c.php that includes a.php

However, I can’t think how to do this.

Please suggest.

  • 1 1 Answer
  • 1 View
  • 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-17T18:35:18+00:00Added an answer on May 17, 2026 at 6:35 pm

    Use include path – will make your life simpler (you can control it even from .htaccess).

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

Sidebar

Related Questions

I would like to use following sql to avoid constructing sql dynamically: SELECT CommentID,
Hello Sir i want send list of data to php server i use following
My goal is to implement the following scheme using the subdomain and path as
I am going to use the following scheme for implementing SSO - Initial login
Using scheme I have the need to use the following function. (All args are
I have the following schema, which I use to ensure that a person's PhoneNumber
I use following style attribute so when i will start typing in text box
I use following code: Create a retry policy, when error, retry after 1 second,
I just use following code to add an image to my project, var paper
When i use following: var child:DisplayObjectContainer = dso.getChildAt( dso.numChildren -1 ) as DisplayObjectContainer; trace(child);

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.