Guide to absolute paths...Data: __FILE__Data type: StringPurpose: The absolute pathname of the running PHP file, including the filename.Caveat: This is not the file called by the PHP processor, it's what is running. So if you are inside an include, it's the include.Caveat: Symbolic links are pre-resolved, so don't trust comparison of paths to be accurate.Caveat: Don't assume all operating systems use '/' for the directory separator.Works on web mode: YesWorks on CLI mode: YesData: __DIR__Data type: StringPurpose: The absolute pathname to the running PHP file, excluding the filenameCaveat: This is not the file called by the PHP processor, it's what is running. So if you are inside an include, it's the include.Caveat: Symbolic links are pre-resolved, so don't trust comparison of paths to be accurate.Caveat: Don't assume all operating systems use '/' for the directory separator.Works on web mode: YesWorks on CLI mode: YesData: $_SERVER['SCRIPT_FILENAME']Data type: StringPurpose: The absolute pathname of the origin PHP file, including the filenameCaveat: Not set on all PHP environments, may need setting by copying from __FILE__ before other files are included.Caveat: Symbolic links are not pre-resolved, use PHP's 'realpath' function if you need it resolved.Caveat: Don't assume all operating systems use '/' for the directory separator.Caveat: "Filename" makes you think it is just a filename, but it really is the full absolute pathname. Read the identifier as "Script's filesystem (path)name".Works on web mode: YesWorks on CLI mode: YesData: $_SERVER['PATH_TRANSLATED']Data type: StringPurpose: The absolute pathname of the origin PHP file, including the filenameCaveat: It's probably not set, best to just not use it. Just use realpath($_SERVER['SCRIPT_FILENAME']) (and be aware that itself may need to have been emulated).Caveat: Symbolic links are pre-resolved, so don't trust comparison of paths to be accurate.Caveat: Don't assume all operating systems use '/' for the directory separator.Works on web mode: YesWorks on CLI mode: NoData: $_SERVER['DOCUMENT_ROOT']Data type: StringPurpose: Get the absolute path to the web server's document root. No trailing slash.Caveat: Don't trust this to be set, or set correctly, unless you control the server environment.Caveat: May or may not have symbolic links pre-resolved, use PHP's 'realpath' function if you need it resolved.Caveat: Don't assume all operating systems use '/' for the directory separator.Works on web mode: YesWorks on CLI mode: NoNote that if something is not set it may be missing from $_SERVER, or it may be blank, so use PHP's 'empty' function for your test.Note that if you call "php --info" on the command line then naturally some of these settings are going to be blank, as no PHP file is involved.