Hello, how do you go about getting the full real path to a file.

Like usr/home/httpd/htdocs/pages/index.php

How would I get that path, assuming I had full access to the server.

Thanks!😃

    echo getcwd(). $_SERVER['PHP_SELF'];
    

    Even browsing the tutorials at php.net will answer that one...

      running phpinfo() will also display you all of the variables which are pre-set on every page. (in that directory, for cookies)

        Hmm that's wierd techy, maybe you can explain what is going on here.

        If I have a file in the www/htdocs/admin folder and I put what you wrote it returns var/www/htmld/admin folder. Turns out there is another identicle admin in that path, but I am definately putting the file first path.

        Why is it returning the other path? Seems very odd.

        Thanks!😃

          Could be their both the same folder? Seems like it. Try on another page including the same file, but with the 2 absolute paths, and see if both work.

            Mmm $_SERVER["SCRIPT_PATH"]

            Not sure. Use google.com

              Write a Reply...