it shouldn't be the version, that functionality has been there since I can remember.
But the $_SERVER variables do depend on the server, so it might be a server difference of setup.
maybe __FILE__ would work for you.
Attached is the stock PHP 5.1.6 php.ini file. Backup your old one and replace it with the stock one, being sure to fill in any server specific information in the ini you need to get PHP running (extension dir, etc.)
I've had this issue before and it turned out to be a corrupted module dll (curl) that was causing my $_SERVER variables (PHP_SELF, SCRIPT_FILENAME, REMOTE_ADDR) to not function properly. It was only when I started with a stock php.ini file and enabled 1 module at a time that I found the issue.
Also, when you quoted your php code in your first post, did you properly terminate the line with a semicolon (";") in your code?