$_SERVER{'DOCUMENT_ROOT'} doesn't work (for me)

Embarrassing, but I can’t get this to work.
[php]<?php //web/auxlib/usit2013/tstCMMNDS.php

echo date('l dS \of F Y h:i:s A ');		

if(file_exists($_SERVER{'DOCUMENT_ROOT'} .'lib/php/cnnct2mysql.php' ))
    echo 'cnnct2mysql exists ';
    else echo 'cnnct2mysql does not exist ';

The file exists at /web/lib/php/cnnct2mysql.php.
What am I doing wrong?
Thanks for any interest/suggestions.

Got around the problem using relative addresses.
I still don’t understand what’s wrong.

I’m not sure what could be the problem with DOCUMENT_ROOT but you could try dirname

[php]dirname(FILE) . ‘/lib/php/cnnct2mysql.php’[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service