间歇性的include_once PHP问题

时间:2013-01-08 14:51:53

标签: php

我在Windows 2008 R2 Server上使用PHP v5.4

我在剧本开头有这个:

<?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.'&code=header1');
    exit;
}

db_include.php如下所示:

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

现在,偶尔页面会失败。 error_log显示以下内容:

[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

什么可能导致这种情况间歇性发生?

0 个答案:

没有答案