Find the full path to a file on a web server

You may need to know the full path to a web directory, perhaps for a script that requires it or setting up a .htpasswd file.

  1. To do this, create a PHP file in the directory you want to find the path to.
  2. Put the following code into it:
    <?php echo dirname(__FILE__); ?>
  3. Run the file on your web server and the full path will be displayed.

Leave a comment

Your email address will not be published. Required fields are marked *