PHP's internal debugger is useful for tracking down evasive bugs. The debugger works by connecting to a TCP port for every time PHP starts up. All error messages from that request will be sent to this TCP connection. This information is intended for "debugging server" that can run inside an IDE or programmable editor (such as Emacs).
How to set up the debugger:
Set up a TCP listener on that port somewhere (for example socket -l -s 1400 on UNIX).
In your code, run "debugger_on(host)", where host is the IP number or name of the host running the TCP listener.