SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Dec 1999
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know how can I retrieve the full path of a file in PHP?. Thanks in advance.

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand what you are trying to do. Do you mean:
    $SCRIPT_FILENAME or $PHP_SELF?
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Zealot
    Join Date
    Dec 1999
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I'd like to know is how I can retrieve the path where the script file is located in the server.
    Eg: /wwwroot/blahblahblah/myphpfile.php. I know this can be done in ASP using Server.MapPath() but I don't know how to do it in PHP.
    Last edited by PGA; Mar 25, 2001 at 16:23.

  4. #4
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, so it's
    $DOCUMENT_ROOT or getenv("DOCUMENT_ROOT"); both are equivalent.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  5. #5
    SitePoint Zealot
    Join Date
    Dec 1999
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Son Nguyen!

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be sure to run the following, it contains some very good information to know about your server :
    Code:
    <?php 
    
        phpinfo();
    
    ?>

  7. #7
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you mean

    <?php
    echo phpinfo();
    ?>

    A program which, when executed produces no output, turns a computer into a very expensive source of heat

  8. #8
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think you need to echo it, sid.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  9. #9
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, yes so I see the function does the outputing!

    How silly of me

  10. #10
    SitePoint Member
    Join Date
    Feb 2001
    Location
    El Paso, TX
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, outputs itself very neatly too, probably one of the most useful features I've found since I started playing with PHP. Great when you want to set up your own box for development, and make sure the environment matches the one you're going to publish to on the web. Makes it very easy to see just how PHP is set up on the server even if you don't have any way to access the actual configuration files.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •