Codice PHP:
function webRoot(){
        return 
dirname($_SERVER['SCRIPT_NAME']);
    }