There are several ways of profiling the PHP code.
The most common may be to profile PHP code using XDebug. However, XDebug cannot show you function call graph and the time spent in each function. There are some solutions to combine XDebug reports with KCacheGrind/WinCacheGrind/MacCallGrind to do that.
But, it is even easier with XHProf where you get call graphs and amount of time spent inside of functions out of the box. XHProf was developed at Facebook as hierarchical function-level profiler. It has PHP extension written in C to collect the raw data, and a few PHP scripts for the reporting/UI layer.
To install the XHProf on Linux start from here.
…tags: profiling & category: php