A simple PHP script to find your web root directory

Here is a simple line of code you can use to find the web root and path of your website.

Copy and paste this code into a text file:

<?php
print ($_SERVER['DOCUMENT_ROOT']);
?>

Save the file as findwebroot.php or whatever name you want, as long as it has a php extension.

Upload the file to your server, navigate to the file in a browser, and voilà Рyou will see the full path to that file!