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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:33:09+00:00 2026-05-10T21:33:09+00:00

On various pages throughout my PHP web site and in various nested directories I

  • 0

On various pages throughout my PHP web site and in various nested directories I want to include a specific file at a path relative to the root.

What single command can I put on both of these pages…

http://www.example.com/pageone.php
http://www.example.com/somedirectory/pagetwo.php

…to include this page:

http://www.example.com/includes/analytics.php

This does not work:

<?php include('/includes/analytics.php'); ?> 

Does it matter that this is hosted in IIS on Windows?

  • 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. 2026-05-10T21:33:09+00:00Added an answer on May 10, 2026 at 9:33 pm

    If you give include() or require() (or the *_once versions) an absolute pathname, that file will be included. An absolute pathname starts with a ‘/’ on unix, and with a drive letter and colon on Windows.

    If you give a relative path (any other path), PHP will search the directories in the configuration value ‘include_path’ in order, until a match is found or there are no more directories to search.

    So, in short, to include an absolute filename, give an absolute filename. See also the function realpath().

    If you want to set your own include ‘root’, have a look at this question (specifically my answer of course 🙂

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

Sidebar

Related Questions

Our site has multiple wizards where various data is collected over several pages, and
I am developing an Rails 2.3.1 Web site. Throughout the Web site, I need
Short Version: What are the chances that a site's various sub-pages' page-ranks will suffer
We have hundreds of document libraries, spread all throughout various site collections in a
I just want to add a side menu that links to various pages on
I have a particular PHP page that, for various reasons, needs to save ~200
I have a web page which allows the user to carry out various operations
On a web project for a client, we want to use a type of
Hi I am using the SharePoint namespace to pull items from various lists throughout
I am creating a site in which I utilize partial views to display various

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.