See http://www.php.net/realpath

realpath() expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input path and return the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components.

On 3/14/07, Darren Oh <darrenoh@sidepotsinternational.com > wrote:
Some users keep contributed modules outside the Drupal directory and
create symlinks to them in sites/all/modules. This causes problems
for Chat Room, which uses a PHP file in its own directory for AJAX
updates (to avoid loading all of Drupal on each update) but must
include some files from Drupal. I was using the following code to
find the Drupal files:

     $chatroom_base = urldecode($_POST['chatroom_base']);
     $depth = substr_count($chatroom_base, '/');
     chdir(str_repeat('../', $depth+1));

If people are keeping Chat Room outside of Drupal, chdir() will need
the absolute path to the Drupal directory. What is the best way to
get this?



--
2bits.com
http://2bits.com
Drupal development, customization and consulting.