PHP display current server path

We can use getcwd it will  give you the base path:

<?php
echo getcwd();
?>

  1. To get your current working directory: getcwd()
  2. To get the document root directory: $_SERVER['DOCUMENT_ROOT']
  3. To get the filename of the current script: $_SERVER['SCRIPT_FILENAME']