Accessing Apache environmental variables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I've installed Apache (WAMP install) so I can edit and test my web
site on my home computer.  In general php code seems to work, but I
can't access Apache variables such as PATH or SCRIPT_NAME.

The code below works perfectly when I upload it to my webhost server.
However, at home, everything processes corectly except the
environmental variables are blank.

Any ideas?



print ( date("g:i A - l, M d, Y"));  
$a="hello world";
 echo '$a = '.$a."\n";
 echo '<br>';                    
 echo 'Script Filename: '.$SCRIPT_FILENAME."\n";
 echo '<br>';
 echo 'Script name    : '.$PHP_SELF."\n";
 echo '<br>';
 echo 'doc_root       : '.$DOCUMENT_ROOT."\n";
 echo '<br>';
 echo 'Path name    : '.$PATH."\n";
 echo '<br>';
 echo 'OSTYPE    : '.$OSTYPE."\n";
 echo '<br>';
 //phpinfo();   //works fine  

Re: Accessing Apache environmental variables

On 12 Feb 2005 10:19:32 -0800, (Bruce Lehmann) wrote:

Quoted text here. Click to load it

 You're relying on the old, deprecated "register_globals" feature, turned off
by default and staying off for sensible installations of PHP. The values you
want can be found in the $_SERVER superglobal, e.g.

 See the PHP manual:

< Space: disk usage analysis tool

Site Timeline