Intermittent include_once PHP Issue
<p>I'm using PHP v5.4 on Windows 2008 R2 Server</p>

<p>I have this at the start of a script:</p>

<pre><code>&lt;?php
include_once "db_include.php";

if (!mysql_connect($server, $username, $password)) {
    ob_end_clean();

    header('Location: http://www.mysite.co.uk/error.php?page='.$page_id.'&amp;code=header1');
    exit;
}
</code></pre>

<p>db_include.php looks like this:</p>

<pre><code>&lt;?php
    //$server = "127.0.0.1:3306";
    //$database = "ab";
    //$username = "ab1";
    //$password = "pwab1";
    $server = "localhost";
    $database = "ab_live";
    $username = "ab_live1";
    $password = "pwabl1";
?&gt;
</code></pre>

<p>Now, occasionally the page fails. The error_log shows the following:</p>

<pre><code>[08-Jan-2013 13:04:03 Europe/Dublin] PHP Notice:  Undefined variable: server in C:\Data\Websites\Site1\wwwroot\header_cb.php on line 11
[08-Jan-2013 13:04:03 Europe/Dublin] PHP Notice:  Undefined variable: username in C:\Data\Websites\Site1\wwwroot\header_cb.php on line 11
[08-Jan-2013 13:04:03 Europe/Dublin] PHP Notice:  Undefined variable: password in C:\Data\Websites\Site1\wwwroot\header_cb.php on line 11
[08-Jan-2013 13:04:04 Europe/Dublin] PHP Warning:  mysql_connect(): Access denied for user ''@'localhost' (using password: NO) in C:\Data\Websites\Site1\wwwroot\header_cb.php on line 11
</code></pre>

<p>What could be causing this to happen intermittently?</p>
