Yes, that appears to be right.
__FILE__
is a constant containing the full pathname to the file it is used in.
Your question states that the path returned is "wrong". What path should __FILE__
return according to you? Keep symlinks in mind: __FILE__
returns the full, real, non-symlinked path, even if you used a symlink to go to that path and created that file.
See: http://php.net/manual/en/language.constants.predefined.php
Since PHP 4.0.2, __FILE__
always contains an absolute path with symlinks resolved
If you would like the URL used to access the file from the browser, see:
Get the full URL in PHP