You can get the directory where the file is currently running using __DIR__or dirname(__FILE__)in <PHP 5.3.
You can go the way and go to several levels using string manipulations.
$path = implode(
DIRECTORY_SEPARATOR,
array_slice(explode(DIRECTORY_SEPARATOR, $path),0,-3)
);
Alternatively this should work ...
$path = realpath(
rtrim($path, DIRECTORY_SEPARATOR) . str_repeat('..' . DIRECTORY_SEPARATOR, 3)
);
realpath() ( ).