Can I use the Debugger in Console Applications

I’d like to use the debugger in my console application so after I run some commands I can view the debugger in the web browser and see the queries and results of what’s being run. I’m using the advanced application template and in my main-local.php file under console/config I’ve inserted the following:


if (!YII_ENV_TEST) {

    // trying to get debugger to work from console

    $config['bootstrap'][] = 'debug';

    $config['modules']['debug'] = 'yii\debug\Module';


return $config;

After doing this in my console/runtime folder I saw a debug folder appear that was not there before, but it is not being populated with any debug files. I’ve made sure in the action of my command I use an exit code and ‘return 0;’ as mentioned here ( but I’m still not able to see any debugging files in that folder or information when I visit the debugging module in my browser.

Is this possible? Does anyone have any ideas?

I have faced the same problem however I haven’t been able to find any ready-made solution.

Using Yii Debugger for console application would require some changes to the Debugger. It’s currently grouped by HTTP requests so it would be necessary to add command line calls.

I’ve ended up creating an extra web controller for debugging components used by console controller.