Root Path and Configuration of your Website using php

There’s times when you need to know the root path of a website as well as all of the configuration details of that server. This is actually very simple, we’ll explain how…

Root path of your site

Open a plain text editor and enter the following:

<?= $_SERVER[‘DOCUMENT_ROOT’];?>

Then save this with a .php extension i.e. root-path.php and upload to the root of your site via FTP. Then type in the url to that file and you’ll see the root path of your home directory.

Configuration details of your site

Find out if your server runs php and all of the configuration details of the server by opening a plain text editor and type the following

<?php phpinfo();?>

Save the file with a .php extension i.e. config-details.php and upload to the root of your site. Type in the url in your web browser and all of the server config details are there to see.

If you’ve found this useful please leave a comment below.

  • Me

    Doesn’t work.