Solved

$_SERVER['DOCUMENT_ROOT']

Posted on 2013-10-22
2
330 Views
Last Modified: 2013-10-22
I am using $_SERVER['DOCUMENT_ROOT'] to determine the location on the server of "where I am". We have a "live" version of the system & a "test" version; the test version is in a folder called test. So, for example, www.xyz.com is live & www.xyz.com/test is test.

When I use $_SERVER['DOCUMENT_ROOT'], I get the path to the live system, even if I am executing in /test.

Why?
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 39591617
Because the 'root' of your web site on the server is the same no matter what subdirectory you are in.
0
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 250 total points
ID: 39591674
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question