Ok say I have a code base that is contained in a folder /myProgram/ and has various folders such as /myProgram/lib/, /myProgram/docs/ and so on...
How, in PHP, can I go about detecting any folders before /myProgram/ and creating a base variable so my includes and require's can be written relative to the base directory /myProgram/ allowing me to place myProgram in anything such as root, my home dir, /path/to/myProgram/, and so on?
Doesn't need to work in windows, just a *nix environment. This is all from the command line parser or executable scripts.