Image 01 Image 02

Latest Post
0
Posted on 21st May 2009 by Sameer

Xdebug is a wonderfully helpful debugger and profiler for PHP. Primarily it serves two main purposes (at least for me). First, it makes error messages so much more helpful because it contains a stack trace that can even be configured to show actual function arguments. Here is an example

Second, it helps profile your code by creating an output file with a full listing of all functions called and execution time for your script. Using a tool like kcachegrind or wincachegrind the output can be visualized in an easy to understand format. I am an avid user of xdebug’s profiling tool as it’s the best way to identify performance problems in your php applications. With all that said:

DON’T RUN XDEBUG ON PRODUCTION.

I’m sure you can imagine the profiler’s output being very large for applications with thousands of function calls. I’ve seen 100MB+ output files. Imagine if php had to create a 100MB file for every request. By turning on xdebug.profiler_enable_trigger, you can at least selectively run the profiler.

Yet, even when the profiler is off, the other primary function of xdebug (detailed stack traces on errors) causes your php instance to track lots of extra information slowing down execution. On a recent real world example where I turned on xdebug temporarily (with profiler off) and then shut it off, xdebug caused average response time to go from 400ms to 700ms.

0
Posted on 17th May 2009 by Sameer
0
Posted on 16th May 2009 by Sameer
0
Posted on 15th May 2009 by Sameer
7
Posted on 14th May 2009 by Sameer
0
Posted on 14th May 2009 by Sameer
0
Posted on 14th May 2009 by Sameer
1
Posted on 4th May 2009 by Sameer
0
Posted on 4th May 2009 by Sameer