Logo

$_SERVER['PHP_SELF'] vs $_SERVER['REQUEST_URI']

Posted under » PHP on 4 April 2010

$_SERVER['REQUEST_URI'] just the file name. /file.php. This may not be the file

$_SERVER['PHP_SELF'] has more path info (in some servers) but basically the same as above. /subdir/file.php

$_SERVER['SCRIPT_FILENAME'] has all the info. /Users/user/Sites/file.php

$_SERVER['SCRIPT_NAME'] kinda the same as above.. test it out if it suits your purposes. /

$_SERVER['DOCUMENT_ROOT'] has only the path. /Users/user/Sites/