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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:08:00+00:00 2026-05-27T06:08:00+00:00

I am setting up a testing environment for a client project for an application

  • 0

I am setting up a testing environment for a client project for an application that was already programmed by someone else. I have created a subdirectory called iftc in the hosting account that we normally use for such purposes.

Now, all include files are not being found as they are being referenced through

include($_SERVER['DOCUMENT_ROOT'].'/Includes/Connect.php'); 

And so on.

Short of setting up a whole new hosting account just for testing purposes for this particular client, can I change the value of $_SERVER['DOCUMENT_ROOT'] somehow to include a subfolder iftc that the files are in?

  • 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-27T06:08:01+00:00Added an answer on May 27, 2026 at 6:08 am

    My preferred solution

    There are a couple of ways to do it but the best is to simply find and replace all uses of $_SERVER['DOCUMENT_ROOT'] with a simple function call.

    So your example would become:

    include(get_my_path() . '/Includes/Connect.php');
    

    Define your current run mode:

    define('RUN_MODE_PRODUCTION', true); // in live mode
    define('RUN_MODE_PRODUCTION', false); // debug mode
    

    Now for the function definition:

    function get_my_path() {
        if(RUN_MODE_PRODUCTION === true) {
            return '/my/path/';
        }
        return '/my/other/path';
    }
    

    Overriding the actual values in $_SERVER is bad idea. Should some one else later come to work on the project it will not be clear what is happening.

    This is a very simplified version of the bootstrapping of environments that I use in production every day.

    Where you can’t do it

    • Apache SetEnv family of functions
    • mod_rewrite RewriteRule ^$ /home \[E=VAR:VAL\]

    Another way you can do it

    When I setup my mass virtual environment for developing I encountered this issue. See http://blog.simonholywell.com/post/1516566788/team-development-server#virtual_document_root

    Because I could not override $_SERVER['DOCUMENT_ROOT'] using either of the above methods I had to do it in an auto_prepend_file.

    I would not recommend that you use this technique to solve this particular issue however as it is better solved at the application level in this case.

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

Sidebar

Related Questions

I have read many posts about setting up unit testing in Zend Framework and
I'm setting up an environment for testing a Silverlight app with RIA Services in
I have a long double constant that I am setting either as const or
I am setting up testing with PHPUnit and Zend Framework and have a niggling
I have a test environment for a database that I want to reload with
Friends, In testing our Oracle Forms application on Vista I have found a interesting
I am setting up testing with QuickTest Pro in an automated environment where I
I'm just setting up the live environment for my new project. Unlike my dev
I'm developing an application that requires testing email. I'm currently using wampserver, but it
The classic problem of testing and setting individual bits in an integer in C

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.