Xdebug offers a great insight into PHP application performance. It should only be run on a development environment though as it affects the performance of php applications. Profiling allows us to see how long each function takes, how many times functions were called, etc.
Lets get it setup.
Use pecl to install the module:
pecl install xdebug
in php.ini add the following:
zend_extension=/usr/lib64/php/modules/xdebug.so xdebug.profiler_output_dir = "/tmp/" xdebug.profiler_enable_trigger = 1
Set a GET, POST or Cookie value to XDEBUG_PROFILE and the request will be profiled.
For example, the simplest way to do this is to set a GET variable. Lets say you wanted to profile http://yourapplication/profile.php you would visit the following URL:
- The output/profile will be saved into /tmp. Download this to your PC and use a program such as QCacheGrind to open it.