To get a Valid Domain, Valid IP & Valid Directory of your domain use the below code in any PHP file
<?php
var_dump($_SERVER["SERVER_NAME"]);
var_dump((isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : $_SERVER["LOCAL_ADDR"]));
var_dump(dirname(__FILE__));
?>