My question is based on this article.
How can you make the profiling data about a PHP code by Xdubug2 and then put it to an app like KCacheGrind?
I have used successfully Xdebug in my Ubuntu, since it highlights my error messages in the browser. However, I have not find any terminal tool like xdebug
.
I would like to have a visual view of my PHP code like this
Add this line to your php.ini
xdebug.profiler_enable = 1
Then, if you happen to run PHP through a webserver you need to restart the webserver, otherwise the conf change is not picked up.
If you are running PHP through cli, then of course no restart is necessary.
Now, when you run your PHP script, a cachegrind.out.PID file is created in the directory specified by xdebug.profiler_output_dir php.ini setting. It is /tmp by default.
That files is the one kcachegrind is able to load.
There are other means to invoke this profile generation, you can read about them at http://www.xdebug.org/docs/all_settings#profiler_enable