How to find absolute path on webserver using PHP

This post is also available in: deDeutsch (German)

The following script shows you the absolute path on the webserver which often can’t be found using FTP alone.

<?php /* path.php */
list($scriptPath) = get_included_files();
echo $scriptPath;
?>

Upload this script to your webspace using FTP and then access it using the browser. It will show you a path like

/var/www/httpdocs/webmail.techoverflow.net/path.php