Let me preface this response by saying that I don't know PHP
but if your script is running on a Linux box you can use readlink
(The system call) on /proc/self/exe this will give you the location
of your script eg /home/user/bin/myscript.php. Cut off the file
name and you have your directory to chdir into. I don't know
how PHP deals with system calls so I'm sorry I can't be of more
help.
Edit:
I may just be confused about what you want to do though
because you don't need to chdir into cwd because by
definition cwd is your current working directory. The directory
that you launch the script from and not the directory that the
script is in (unless of course the your cwd is the directory the
script is in).
Last edited by LogicG8; 05-03-2005 at 03:07 PM.
|