简体   繁体   中英

php error_log weirdness

i have a global variable debug_smart404 in my smart404.php code:

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

which i use numerous places:

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...

so when i set debug_smart404 == 5, i get the expected output for the instances outside the 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: ignored_patterns_array=@wp-.*@i,@(ing|s|er|est)$@i,@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/?$@i,@\\.(html|php)$@i,@/?\\?.*@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

but note that the error_log output inside the while loop's if statements is missing...but only on my production server (a netsol vps)

it works fine on my test server (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: ignored_patterns_array=@wp-.*@i,@(ing|s|er|est)$@i,@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/?$@i,@\.(html|php)$@i,@/?\?.*@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

wtf??? running php5 on both, and it used to work on vps (debug=1 output here)-:

[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

or is this some feature of netsol's vps hackery?

The error log inside the while IS printed; your own paste of the error log from production server shows it "inside while: debug_smart404 =5"

You have missed a lot of code behind that '...'. Is it possible that your code gets inside the while loop, but then (on production) either quickly breaks out/or continues, BEFORE it reaches the other error log statements. Can you rule that out positively?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM