My console commands aren't found - why?

I’ve been trying to Google on this but can’t seem to find a good answer.

For some reason my console commands aren’t found by yii.

Whenever I run php yii ControllerName I get a “Error: Unknown command ‘ControllerName’”.

I have my “HelloController.php” in both app/commands and app/console/controllers (just trying the different folder for basic/advanced to see if there’s any missconfigurations somewhere) but it’s the same output for both.

When I run php yii I get the "help screen" like this, with no extra controllers specified:

This is Yii version 2.0.0.

The following commands are available:

- asset     Allows you to combine and compress your JavaScript and CSS files.

- cache     Allows you to flush cache.

- fixture   Manages fixture data loading and unloading.

- help      Provides help information about console commands.

- message   Extracts messages to be translated from source files.

- migrate   Manages application migrations.

To see the help of each command, enter:

  yii help <command-name>

I’m running the basic-template and I’ve moved my /app folder above root so I have two folders “/app” (yii) and “/public” (webroot).

Any ideas how I can troubleshoot this further?


please post contents of app/commands/HelloController.php

It looks like this:


namespace app\commands;

use yii\console\Controller;


 * Hello - Command/Controller


 * @package     yii/commands

 * @author      Johan Strömqvist

 * @version     1.0


class HelloController extends Controller



     * Index



    public function actionIndex($str='hello world')


        echo $str;



php yii hello


php yii helloController

Yeah I’m doing “php yii hello” (sorry if I was unclear on that). It says “Unknown command”.

If you look att the “php yii” output as well the “hello” controller isn’t listed.

Any ideas?


It’s like YII isn’t looking in my /app/commands folder for any Controllers. No?


The solution was that I’d for some reason removed this line from my console.php configuration file.

'controllerNamespace' => 'app\commands',