Jump to content

Need code string for "path"


Dhira

Recommended Posts

Hi all,

simple request. I need the php code string that gives me the path in a URL.

Similar to $_SERVER[SERVER_NAME], (which gives me www.domain.com.)
I would like the code that would give me "/home/username/public_html" path (which would show the actual username).

I tried $_SERVER[PATH], - didnt work. would it have 'ROOT' in there somewhere?
Link to comment
Share on other sites

Thanks, but that didnt work for what I'm susing it for - it might be because the file that has that code is inside another folder. Just a giess.

Is there another option that would get the "/home/username/public_html/" path if the path is being requested from within another folder?
Link to comment
Share on other sites

Create a file with this line in it:
[code]<?php p.hpinfo(); ?>[/code]
(remove the period between the p and h --- there is something really screwed up with the code parsing algorithms on this board)
Upload it to your server and invoke it. Look at all of the information returned and pick the one that most fits your needs. When I do it on one of the servers I use, the information I think you're looking for is contained in $_SERVER["SCRIPT_FILENAME"] and $_SERVER["PATH_TRANSLATED"]. YMMV

Ken
Link to comment
Share on other sites

Thanks. Those didn't work the way I wanted, but it helped me figure out what I needed.

I added a variable called:
$PathFolder = $_SERVER["DOCUMENT_ROOT"];

and I entered $PathFolder in the line where I wanted it to appear, and that worked.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.