Entry
How do you find the current working directory? Why isn't there a 'pwd()' function?
Sep 11th, 2002 12:11
Dan Stockton, Leon Atkinson, Chris Kings-Lynne, http://www.php.net/manual/en/function.getcwd.php
One way you can figure this out is to use the __FILE__ constant. It
constains the full path the file being executed. You can use dirname()
to chop off the file name. Try this script:
<?
print(dirname(__FILE__));
?>
This will be your working directory when your script starts, so if you
use chdir(), you'll have to track it yourself.
[+ + +]
.. <?=getcwd()?> will do the same thing, only cheaper