How can I get PHP to produce a backtrace upon errors?

backtrace, debugging, error-handling, php, stack-trace

Solution

Xdebug prints a backtrace table on errors, and you don't have to write any PHP code to implement it.

Downside is you have to install it as a PHP extension.

Problem

Trying to debug PHP using its default current-line-only error messages is horrible. How can I get PHP to produce a backtrace (stack trace) when errors are produced?

Original source