php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19510 $_SERVER[DOCUMENT_ROOT] UNAVAILABLE
Submitted: 2002-09-19 20:01 UTC Modified: 2002-09-26 17:54 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kkobashi at thegrid dot net Assigned:
Status: Not a bug Package: IIS related
PHP Version: 4.2.2 OS: Win NT 4.0 Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kkobashi at thegrid dot net
New email:
PHP Version: OS:

 

 [2002-09-19 20:01 UTC] kkobashi at thegrid dot net
Major problem making PHP4 useless in a large development portal/enterprise scenario!!!

PHP 4.2.2
Windows NT 4.0 Server Build 1382
IIS 4.0

Calling $_SERVER["DOCUMENT_ROOT"] results in an unknown index

The ramifications of this bug is serious enough to cripple my entire development as I will not be able to include() or require() files across many directories.

My development is in Windows, however my hosts are in Unix/Linux. I simply cannot use ini_get('doc_root') as a solution because then I have to switch the entire code to $_SERVER[DOCUMENT_ROOT] before uploading to the servers.

I can't believe noone else posted this bug anywhere - because it is on a plain Windows NT server system!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-19 20:03 UTC] kkobashi at thegrid dot net
Typo... build is 1381 NT 4.0 Server
 [2002-09-19 20:12 UTC] alan at akbkhome dot com
looks like a bug, - but as an aside, you could consider..

#nicest - or add it to php.ini
ini_set('include_path', 'standard/install/location');
#which enables all includes to look
include 'Database/TableClass.php';



#klunky, but effective
include dirname(__FILE__).'/../../somefile.php');
 [2002-09-26 17:54 UTC] iliaa@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

Server variables are made avaliable to PHP by the Web server, in your case IIS 4.0. Guess what, IIS 4.0 does not export/set a variable DOCUMENT_ROOT, which is why PHP does not have it.
In fact you should not be using DOCUMENT_ROOT but rather include_path like alan@akbkhome.com suggested.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 00:04:09 2023 UTC