Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 29th, 2003, 05:49 PM
Authorized User
Join Date: Jun 2003
Location: San Jose, CA, USA.
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?


Reply With Quote
  #2 (permalink)  
Old October 29th, 2003, 06:53 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

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,

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.