How to determine when a script fails?

I have an IVR which is a custom destination in freepbx (no worries) then it launches a PHP script.

However later when I press one option in the IVR it dies and hangs up.

How do I dermine when/why it fails? Spawn extension (custom-makepublic, 1, 1) exited non-zero … although 1,1 works fine and the other options work fine so it must be something in the script.
Console says Verbosity is at least 7

Is that not high or low enough? When I try asterisk -vvvgc it gives it an error message and says asterisk -r to reconnect.

So when I enter the program and quit it is the same error again. How can I exit the program and reconnect again with the right level of detail?

Thank you!