Fixed issue #2515: PHP error handling too weak

The script is halted and a '500 Internal Server Error' is issued when a fatal error occurs.

Fixes #2515