Finding absolute path on your web server

There are times when you need to find the path of the files/folders in your web server and the simplest way to find it is by creating a file that when it is loaded up it will display the absolute path of your file.

Step 1
Create a file, you can call it with any name you want. In this example we’ll call it path.php. Into this file, paste the following codes:

<?php
echo realpath(dirname(__FILE__));
?>

or you can use:

<?php echo $_SERVER['DOCUMENT_ROOT']; ?>

Save the file and upload it to your server.

Step 2
Load/access path.php from your browser. It should display your absolute path.

Remember to delete the file from your server once you’ve no use for it anymore for security reasons.