You have 2 solutions. You can either use the full URL to the file, for instance if your file is in the 'lib' directory you can use:
require_once ('http://www.example.com/lib/myfile.php')
or
You can try the $_SERVER['DOCUMENT_ROOT'] function in PHP but this isnt always fool proof.