How to find absolute path on webserver using PHP

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

get_absolute_path.php
<?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

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

Check out similar posts by category: PHP