Jump to content


Photo

get path of currently running script


  • Please log in to reply
2 replies to this topic

#1 warnockm

warnockm
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 30 May 2006 - 03:07 PM

This should be simple, but i can't think of how to do it. I want to get the path of the script that's currently being run. I have an application in both a running and test folder, and i want to know which path its in. I have used getcwd(), but that is the directory from which you are running the script. I'm running the script from the command line.

thanks!

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 03:19 PM

Try:
$path = dirname($_SEVER['PHP_SELF']);

~ D Kuang

#3 warnockm

warnockm
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 30 May 2006 - 04:35 PM

[!--quoteo(post=378393:date=May 30 2006, 11:19 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 30 2006, 11:19 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try:
$path = dirname($_SEVER['PHP_SELF']);
[/quote]


Thanks, but it just returns "." when you run it from in that directory. any way to see the full path?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users