Diagnosing game setup problems is to me one of the biggest hassles in BGA. Site admins, please find a way to capture diagnostics that are not currently available (i.e. all of those before the first active player state).
Tracking them down is possible. As others have posted, die() helps, but here are also a few development strategies that also help:
1. Get a working simple setup (all the way back to a basic tutorial game setup if you have to).
2. Make very small incremental changes, which you can back out if they cause a problem. (This also works in Javascript.) Scrutinize problem changes for things like parameter typing and unexpected type conversion, which can be silent evils in PHP and JS.
If you have a working game setup (enough to get to a first active player) but Something Is Wrong, add a database table where you can log your own information. You can then examine its contents in the database console for clues to your problems once the game reaches that stable state.