Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

  • Exits

  • Categories

  • Archives

  • Tags list

    How to find absolute path on a web-server (using PHP)

    30th April 2007

    When using PHP, the simplest way to find the absolute path of your files/folders on the server is by creating a simple path.php file with the following contents (click on the "Plain text" box header for copy-pasting):

    PHP:
    1. <?php
    2. echo realpath(dirname(__FILE__));
    3. ?>

    Put the new file anywhere in the web-accessible folder on your server,
    then just access that file from your favourite web-browser - and you'll have the absolute path shown to you.

    Alternatively, you may use the following code:

    PHP:
    1. <?php
    2. ?>

    This also should display the absolute path on your server.

    • Delicious
    • Google Bookmarks
    • Yahoo Bookmarks
    • Windows Live Favorites
    • Technorati Favorites
    • Digg
    • Slashdot
    • StumbleUpon
    • Read It Later
    • Twitter
    • Share/Bookmark

    3 Responses to “How to find absolute path on a web-server (using PHP)”

    1. Sabuj Kundu aka Manchumahara Says:

      Thanks. It works.

    2. Anup Says:

      Thanks a lot

    3. Vishal Says:

      Thanks it worked.

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>