Linksku
Linksku

Reputation: 1459

How can I track each "step" of a program in PHP?

For example, in my error_log, it says something like:

Error... require, include, a_function, another_function

Basically it tracks each step of the program. I want to implement something like this for debugging purposes. How do I "track" the execution of the program in PHP?

Upvotes: 3

Views: 141

Answers (3)

Michael Berkowski
Michael Berkowski

Reputation: 270599

In addition to debug_backtrace() as mentioned by others, I would recommend installing Xdebug and making use of the code profiler therein. When coupled with a cachegrind application to analyze the profile, you can easily view and page through a full trace of your script's execution with execution times per function call.

Upvotes: 0

zerkms
zerkms

Reputation: 254886

You need debug_backtrace() and custom error handler

Upvotes: 1

brianreavis
brianreavis

Reputation: 11546

The debug_backtrace / debug_print_backtrace functions :)

Upvotes: 0

Related Questions