Enable Xdebug profiler in PHP CLI

When running with Apache PHP SAPI, the Xdebug profiler can be triggered by appending the « XDEBUG_PROFILER=1 »  to the GET or POST request.

But how do you trigger the profiler with the CLI SAPI?

You would be tempted to set a XDEBUG_PROFILER=1 environment variable, but it won’t help…

The trigger in CLI is not that obvious, and here is the environment variable you need to set :

XDEBUG_CONFIG="enable_profiler=1"

The full options supported by this environment variable are detailled in the xdebug.org/docs/remote page, but I always forget about it :/

Ce contenu a été publié dans code. Vous pouvez le mettre en favoris avec ce permalien.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*