For example:
This worked for me, maybe it will help someone else.
My situation is I have a js file that uses getScript. In that script i have a bunch of .load() calls to a php file. At the top I place this.
if (file_exists("../../../wp-load.php"))
{
require_once("../../../wp-load.php");
}
Change the ../
to how ever many directories your wp-load file is up.
Edit - Using WP 3.4.1