php-xdebug: profile a single cli script without enabling xdebug profiling globally
Create xebug profile only for the current script run and not for everything php-related:
/usr/bin/php -d xdebug.profiler_enable=1 -d xdebug.profiler_output_dir="/path/to/xdebug/output" SomeFancyCliScriptHere.php
We pass two parameters:
- xdebug.profiler_enable=1 enabled/activates the profiler for this php-scripts execution
- xdebug.profiler_output_dir set the directory where the profile will be put in
Using webgring, kgrind, et al we can visualize the resulting profile and can take measures for what particular problem we might encounter.