Is it a bad idea to search for app config file up the dir structure?
<p>I have a php app with a configuration file in its root. If I include it by it's absolute path, then I get a problem when I move the app elsewhere. If I include it by relative path, I get a problem when I move the file where the config is included. So, I've come up with something like this to search for the app config file down the directory structure. </p>

<pre><code>$relative_path = "";
for ($i=0; $i&lt;6; $i++) {
    if (file_exists($relative_path."config.php")) {
        require ($relative_path."config.php");
        break;
    } 
    $relative_path .= "../";
}
</code></pre>

<p>Could this be a bad idea?</p>
