How should I set up configs in PHP that can be accessed in includes?
<p>I'm building a PHP application and I'm not quite sure how to store global configuration settings that can be truely accessed anywhere - it seems that content that <strong>is</strong> included cannot access other content included from the main, starting page. For example, if index.php includes foo.php and bar.php, bar.php don't have foo.php but index.php has both of them - the included files just can't refer to the other ones. Is this correct? </p>

<p>If yes, how would I set up something like this up? </p>

<p>index.php</p>

<pre><code>&lt;?php
include 'functions/load.php'
echo getHeader();
?&gt;
</code></pre>

<p>functions/load.php:</p>

<pre><code>&lt;?php
include_once 'config.php'
include_once 'header.php'
//loads the includes
?&gt;
</code></pre>

<p>functions/config.php:</p>

<pre><code>&lt;?php
//I want to store the site URL here.
$siteURL = "http://127.0.0.1";
?&gt;
</code></pre>

<p>functions/header.php:</p>

<pre><code>&lt;?php
function getHeader(){
    return "Header for " . $siteURL;
}
?&gt;
</code></pre>

<p>How can I set up an config file that can be then accessed anywhere, including inside other included files? Also, is including a file that lists the other includes good practice?</p>
