Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2003, 05:49 PM
Authorized User
 
Join Date: Jun 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Environment Variables

I think I've asked this before, but I'm having problems with environment variables. It's Win2K Server, PHP 4.3.??, IIS (not Apache). Every time I try and pull $DOCUMENT_ROOT, I get an "Undefined Variable" error.

I've tried, "$_SERVER["DOCUMENT_ROOT"]" As well as "$HTTP_ENV_VARS["DOCUMENT_ROOT"]" and neither of them worked either. I think it's a setting in PHP.ini, but I could be wrong. Got any ideas?

--cmiller

----------
~cmiller
__________________
----------
~cmiller
 
Old October 29th, 2003, 06:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Anything you get from $_SERVER are variables exposed to PHP by the webserver, and they're usually set in the web server's configuration. (Similarly, the variables in $_ENV are the environment variables exported by the shell/OS environment that are available to the PHP parser.) The documentation doesn't say which variables are exposed and which aren't, they just give a list of all the variables that *MIGHT* appear as indexes in the $_SERVER array.

Perhaps simply using print_r() to dump the contents of $_SERVER and/or $_ENV will tell you what you have to work with.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Building and passing Environment variables Durkee VB.NET 2002/2003 Basics 0 November 7th, 2007 04:25 PM
Environment variables dotnetprogrammer VS.NET 2002/2003 3 November 30th, 2004 10:10 AM
Environment Variables Error axla BOOK: Beginning ASP.NET 1.0 0 May 23rd, 2004 02:43 AM
configuring environment variables pete_m BOOK: Beginning ASP.NET 1.0 0 April 28th, 2004 04:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.