1

having another go at this as I didn't word the question well originally - hopefully better this time!

I'm trying to debug a sporadic 500 error which users occasionally get when filling out form sections on my site. Whenever it happens, I try to recreate their environment and fill out the form exactly as they have done, but can never recreate the issue. I have checked my application logs for the framework I am using, but they report nothing related to the error. I'm hoping someone here might be able to help me catch this. This is where the 500 error is sometimes happening and this triggers the error which users report:

//In jquery AJAX function, which submits data to PHP form for processing 
error: function(data,transport){ 
$.validationEngine.debug("error in ajax response: "+data.status+" "+transport) 
}

Is there a way for me to try and catch what the exact error is here? The problem is I can't recreate the error, either using an AJAX call or not to call the PHP script. I need to catch the error response from the PHP script being called, but I never get an error when trying to recreate the user issue, i.e same OS/browser/exact same form answers.

The Apache error logs for the site have very little - unless I'm looking in the wrong place. I'm on CentOS, ran locate error_log and got an error_log.txt file in my vhosts directory for my site, but this just contained a 302 message log, nothing else. I also tried locate error | grep mysite, which just shows the error_log.txt file mentioned.

pnuts
  • 58,317
  • 11
  • 87
  • 139
user1153594
  • 281
  • 2
  • 20
  • See if this helps: http://stackoverflow.com/questions/1349118/jquery-ajax-post-results-in-500-internal-server-error – Jeremy Harris Feb 29 '12 at 16:34
  • Apache error logs in CentOS are typically in `/var/log/httpd/error_log` – cOle2 Feb 29 '12 at 16:37
  • I saw your earlier question and I don't see if this question is any different. Can you verify that the php.ini setting `log_errors` is On and post what you got in the file referenced by `error_log`? – Salman A Feb 29 '12 at 16:41

1 Answers1

0

according to this article: http://www.phpro.org/examples/PHP-Errors-As-Exceptions.html you can use PHP Errors as Exceptions.

Just do a try-catch block and do an output of the error to your ajax data.

Stefan
  • 2,028
  • 2
  • 36
  • 53