diff between script_filename, path_translated
| From: | John Schulz | Date: | Fri, 30 Jan 2004 16:20:58 +0000 |
| Subject: | diff between script_filename, path_translated | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176350@lists.php.net to get a copy of this message | ||
After reading the manual entry on $_SERVER predefined variables, I'm unclear on the difference between 'SCRIPT_FILENAME' and 'PATH_TRANSLATED'.
Results from a test script, run from a few different locations on my webserver, were always the same for these two variables.
I'm especially confused by the "Filesystem- (not document root-) based path" comment for 'PATH_TRANSLATED'.
On a pseudo-related topic: what should you use to find the absolute path from root to your application directory when you need to include a file? For example, I'm writing an application that has a function library in 'app/lib/'. From any file in the application, at any directory level, I want to be able to include specific files from the library.
What's the best way to find '/absolute/path/from/root/' from '/absolute/path/from/root/app/*/any_file.php'?
Since the path you get from 'DOCUMENT_ROOT' isn't necessarily where the executed file is (e.g., user directories), should that be avoided for this type of task?