2013-03-14 48 views
0

我在我的smart404.php代碼中的全局變量debug_smart404:PHP error_log中的怪事

$debug_smart404 = intval(get_option('debug_smart404')); 
    error_log("smart404_redirect: debug_smart404 =" . ($debug_smart404)); 

,我用的很多地方:

if ($debug_smart404 > 4) # lotsa debug! 
{ 
    error_log("smart404_redirect: take_1st_match=" . ($take_1st_match ? "yes" : "no")); 
    error_log("smart404_redirect: take_exact_match=" . ($take_exact_match ? "yes" : "no")); 
    error_log("smart404_redirect: search_whole_uri=" . ($search_whole_uri ? "yes" : "no")); 
    error_log("smart404_redirect: walk_uri=" . ($walk_uri ? "yes" : "no")); 
    error_log("smart404_redirect: ignored_patterns_input=" . $patterns); 
    error_log("smart404_redirect: ignored_patterns_array=" . join($patterns_array,",")); 
      error_log("smart404_redirect: search_groups=" . join($search_groups,",")); 
} 
while (TRUE) 
{ 
    error_log("smart404_redirect:inside while: debug_smart404 =" . ($debug_smart404)); 
... 
    if ($debug_smart404 > 3) # less debug 
    { 
     error_log("smart404_redirect: search_words=" . $search_words); 
     } 
... 
     if ($debug_smart404 > 0) { 
      error_log("smart404_redirect: uri=" . $uri . "= #matches=" . $mct); 
     } 
... 
} #end while... 

所以當我設置debug_smart404 == 5,我得到預期的輸出爲while以外的實例:

[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: debug_smart404 =5 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_1st_match=yes 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_exact_match=yes 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_whole_uri=no 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: walk_uri=yes 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: ignored_patterns_input=wp-.*\r\n(ing|s|er|est)$\r\nprivate/.* 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: [email protected]*@i,@(ing|s|er|est)[email protected],@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/[email protected],@\\.(html|php)[email protected],@/?\\?.*@i 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_groups=pages,posts,categories 
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect:inside while: debug_smart404 =5 

但需要注意的是error中的error_log輸出循環的if語句缺失......但只有我的生產服務器(VPS netsol)上

它工作正常我的測試服務器(lighttpd的)上:

2013-03-14 08:26:40: (mod_fastcgi.c.2711) FastCGI-stderr: smart404_redirect: debug_smart404 =5 
smart404_redirect: take_1st_match=no 
smart404_redirect: take_exact_match=no 
smart404_redirect: search_whole_uri=yes 
smart404_redirect: walk_uri=yes 
smart404_redirect: ignored_patterns_input=wp-.* 
(ing|s|er|est)$ 
private/.* 
smart404_redirect: [email protected]*@i,@(ing|s|er|est)[email protected],@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/[email protected],@\.(html|php)[email protected],@/?\?.*@i 
smart404_redirect: search_groups=pages,posts,categories 
smart404_redirect:inside while: debug_smart404 =5 
smart404_redirect: search_words=cavitronix.com xxx zzzxxxx 
smart404_redirect: uri=/cavitronix.com//xxx/zzzxxxx= #matches=0 

跆拳道???在兩個運行PHP5,並用它在VPS(調試這裏= 1個輸出)工作 - :

[Thu Mar 14 06:32:55 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/how-it-works= #matches=1 
[Thu Mar 14 06:41:32 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/videos/e2c-overview/private/awstats/current/new.html= #matches=10 
[Thu Mar 14 06:53:38 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/current/previous.html= #matches=3 
[Thu Mar 14 06:54:47 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/press-releases= #matches=3 

或者這是netsol的VPS兩輪牛車的一些特點?

回答

0

while IS打印的錯誤日誌;您自己從生產服務器上粘貼的錯誤日誌顯示它「在while:debug_smart404 = 5中」

您錯過了很多「...」後面的代碼。是否有可能你的代碼進入while循環,但是(在生產中)或者快速發生或繼續,直到達到其他錯誤日誌語句。你能否正面排除?

+0

我會拋出另一個調試和檢查,thanx ...如果這是問題,那麼在centos/apache/php和fedora/lighttpd/php之間有區別: - \ – airdrummer 2013-03-15 14:29:56

+0

這是問題,對不起4 goatrope ... – airdrummer 2013-03-16 23:41:55