It would be most correct to say "they will occasionally have the same value".
If you are using the command line version (the 'CLI'), then PHP_SELF will be undefined, and SCRIPT_NAME will have the relative path as specified by the user.
If you are using Apache under windows, then there seem to be known bugs with both - not sure if that's current though, but for more info on that, do a google search for: SCRIPT_NAME PHP_SELF
Apache under Linux and some other servers will set apparently SCRIPT_NAME to be the same as PHP_SELF, but from the documentation, this is wrong.
PHP_SELF should be the absolute
URL path, SCRIPT_NAME the absolute
OS path.
Say you have a script at "/home/bob/public_html/myscript.php", and that's accessible as "
http://www.example.com/~bob/myscript.php".
As I understand it fromthe doc, when calling it by that URL, SCRIPT_NAME
should be "/home/bob/public_html/myscript.php" and PHP_SELF
should be "/~bob/myscript.php". What they are on your system may or may not match this.
Here's the relevant doc: see if you agree with how I'm reading it.
http://uk2.php.net/reserved.variables