0

I have a script that produces a report. For most widgets* it produces a report with no problem. For a particular widget it exits in the middle during a mysql query and a 500 is returned to the browser. By inserting writes to the php_error log I know the exact last line to be executed and it's always the same line. It's not a timeout because other widget reports run longer (and it bombs out in about 10 seconds).

Also, I've tried running the query it's trying to run in phpadmin and it runs OK.

When this abort occurs I see nothing appear in php_error.log, nothing in apache's error log and when I surround the offending statement with a try/catch, no exception is caught.

Is there somewhere else I can look that might show what error is occurring?

* by widget I'm not referring to a UI component. I'm using widget in the sense of fictional product from a fictional company

addendum ====================================================================== Since it was requested I posted the code although I think the problem isn't the code since it works in all but this once case. The problem is more likely in the data for this particular case.

error_log('['.__FILE__.']['.__LINE__."] check");

$table = new metrics_sessions();

//here I print out the SQL statement that will eventually be executed
error_log('['.__FILE__.']['.__LINE__."] check: "."guider_slug=? ".($effective_mindate!=null?" and date>'".$effective_mindate."'":"").($effective_maxdate!=null?" and date<'".$effective_maxdate." 23:59:59'":"").($effective_version!=0 && $effective_version!="all"?" and version=".$specific_version:"").($effective_campaign!==null && $effective_campaign!="all" ?" and campaign='".$effective_campaign."'":"")." order by date");

// BELOW IS THE LAST LINE I SEE IN PHP ERROR
error_log('['.__FILE__.']['.__LINE__."] check"); 

try {

    $sessions = $table->Find("guider_slug=? ".($effective_mindate!=null?" and date>'".$effective_mindate."'":"").($effective_maxdate!=null?" and date<'".$effective_maxdate." 23:59:59'":"").($effective_version!=0 && $effective_version!="all"?" and version=".$specific_version:"").($effective_campaign!==null && $effective_campaign!="all" ?" and campaign='".$effective_campaign."'":"")." order by date",array($param_gslug));

    error_log('['.__FILE__.']['.__LINE__."] check");

}catch(Exception $e){

    error_log('['.__FILE__.']['.__LINE__."] check");
    error_log('Caught exception: '.$e->getMessage());
    error_log('File: '.$e->getFile());
    error_log('Line: '.$e->getLine());
    error_log('Trace: '.$e->getTraceAsString());

}

error_log('['.__FILE__.']['.__LINE__."] session count: ".count($sessions));
15
  • If you omit that particular widget, does the script complete? Or does it always stop after a certain number? Commented Aug 18, 2011 at 17:31
  • Do you see an error supression symbol (@) anywhere near that line? Or within the function that is called on that line? If so, remove it. Commented Aug 18, 2011 at 17:32
  • 1
    @Chris I added the offending section of code although Commented Aug 18, 2011 at 17:39
  • Sure the problem might be in the data, but the real problem here is that your not getting an error message which would allow you to debug. Commented Aug 18, 2011 at 17:44
  • So $table->Find is failing? Have you looked inside that code to see if there is any error suppression? Commented Aug 18, 2011 at 17:46

2 Answers 2

1

Check for error supression operators (@) in your code and the code you are calling.

Sign up to request clarification or add additional context in comments.

4 Comments

Added this for posterity and so I can get the cred =P
Well, I did find that it isn't the query that's bombing. The actual mysql_query that ultimately gets called didn't have the @ and when I surround the call with statements to write to the error log, I see both statements. So it's bombing somewhere between getting the results and actually returning from the ->Find()
Keep putting log writes at half way points (binary search) and you'll find the troublesome call soon enough.
The adodb wrapper code was crashing due to (I assume) a memory problem when a query returned more than 500,000 rows. Copying the array returned from mysql_query to it's own structure killed the script. It never did return an error message. Thanks for your help.
0

Try editing your error php.ini file to allow warnings and error codes to be displayed.

error_reporting = E_ALL | E_STRICT  

This would be sufficient.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.