I didn't follow the link posted by psych..
2 quick ways. if you are one directory above say localhost/dir1/dir2
you can reference dir1 with ../ and localhost with ../../
// another way is to use your environment variable for your server.
//just do an echo $_SERVER['DOCUMENT_ROOT'];
// and you can set your 'direct' paths up off of the
// will give you the base path to your web directory, I believe in your case would be localhost.
include($_SERVER['DOCUMENT_ROOT'] . "/directory1/core.inc.php");