Use SCRIPT_NAME not PATH_INFO in PHP

You should use

$_SERVER['SCRIPT_NAME']

not

$_SERVER['PATH_INFO']

in PHP. PATH_INFO has been monkeyed with in some versions (and when running as FastCGI?) so sometimes it appears as PATH_INFO and other times as ORIG_PATH_INFO and PATH_INFO does not exist in the $_SERVER array. SCRIPT_NAME seems to have had a far less chequered history. Sometimes I think there could be a new beautiful version of PHP without little gotchas like this, but then that wouldn’t really be PHP would it?


About this entry