|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how can i find the absolute path from a script?
is it possible for a script to give it's absolute path?
i want to put a script somewhere and be able for it to reports its own absolute path. thanks. om |
|
#2
|
|||
|
|||
|
Try _SERVER["PATH_TRANSLATED"]
You could also run php_info(); and review the PHP Variables section. |
|
#3
|
||||
|
||||
|
You can use the "magic" constant __FILE__ (note that it both begins and ends with double underscores).
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
|
#4
|
|||
|
|||
|
sorry, you misunderstand what i want.
i want the internet web address. so if a file sits in: http://www.mydomain/dir1/subdir this is exactly what i want: http://www.mydomain/dir1/subdir (it doesn't matter if i get back an ip number, as long as i can identify the exact directory with path.) also... i tried: <?php echo _SERVER["PATH_TRANSLATED"] ?> this didn't work. (i'm a newbie to php... have i typed it correctly above?) |
|
#5
|
||||
|
||||
|
try this (Notice the $)
PHP Code:
__________________
Auckland, New Zealand, Web Design & Hosting. - Inbox Design Sheldon Lendrum, Technology, PHP, Mootools & More... Simple Site a Completely Dynamic site using text files, PHP and no mySQL. |
|
#6
|
|||
|
|||
|
brilliant.
nearly what i wanted. ![]() i wanted just the path without the calling filename itself. i'm sure i can string manipulate to get rid of the filename... but is there a better way? thanks. |
|
#7
|
||||
|
||||
|
PHP Code:
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
|
#8
|
|||
|
|||
|
Thank You!
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|