 <p>Use <a href="http://php.net/manual/en/reserved.variables.server.php" rel="nofollow">$_SERVER['DOCUMENT_ROOT']</a> to find the root folder.</p> <pre><code>$dir = $_SERVER['DOCUMENT_ROOT']; // will return /home/vadar/Dropbox/ENELWebsite/public_html/ if(file_exists($dir)){ //just to make sure define('APP_DIR', $dir); //home comp } else{ echo 'No include directory exists'; } </code></pre>