I've files offered like so:

AJAX request handler -> Include file

I must retrieve the title from the include file inside the include itself. Neither $_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME'] is appropriate with this, because they return the "parent" script title.


If you would like just the title area of the file (with no directory) you should use basename(__FILE__) or only the directory dirname(__FILE__).

Unfortunatly this doesn't focus on a setup with multiple linked servers. __FILE__ shows the particular filename, however the path could be different that DOCUMENT_ROOT. On some servers this will cause a 500 server error.

I haven't found a means yet to obtain the filename from the current incorporated file in accordance with DOCUMENT_ROOT.