I’m developing a web service with Zend, more specifically I’m Zend_Amf for interop with Adobe Flex. The problem with this is that I can not easily see PHP errors because the Flex debugger won’t display the actual answers from the server unless they are proper Amf. If I visit the Zend_Amf endpoint with the Web Browser I don’t get any errors, so the error is while executing an Amf handler. Right now I’m using firebug to inspect the HTTP traffic to see any errors.
To my question: can I use a log utility (like Zend_Log) to log all PHP errors, warnings and notices to a file instead of (or in addition to) sending them in a HTTP response?
you can use
set_error_handlerto catch PHP errors and use Zend_Log to log them as you please.The only problem with this function it won’t catch all PHP errors, it is not possible to catch errors like syntax errors ….
An other method is to play with the
register_shutdown_functionfunctionlike this:
It’s worth to be noted then even by combining both methods it won’t catch all errors, like syntaxes errors …. But you could see that kind of error using a normal browser.