[SOLVED] Issue with custom console command

Hi -

I am using Yii 2.0.10 with PHP 7, and I started coded from the advanced-template.

I have created a custom command which I want to run from the console. It works great on my test server configured as dev (Windows) but it does not work on my prod server convigured as prod (Ubuntu).

I can run all the core commands without any issues and when I run php yii I do see my newly created console command.

I have multiple controllers but even the basic one returns Unknown command when run


namespace console\controllers;

use yii\console\Controller;

class HelloController extends Controller


    public function actionIndex()


        echo "Hello world";



php yii returns

The following commands are available:

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

    asset/compress (default)   Combines and compresses the asset files according to the given configuration.

    asset/template             Creates template of configuration file for [[actionCompress]].

- cache                        Allows you to flush cache.

    cache/flush                Flushes given cache components.

    cache/flush-all            Flushes all caches registered in the system.

    cache/flush-schema         Clears DB schema cache for a given connection component.

    cache/index (default)      Lists the caches that can be flushed.

- fixture                      Manages fixture data loading and unloading.

    fixture/load (default)     Loads the specified fixture data.

    fixture/unload             Unloads the specified fixtures.

- hello

    hello/index (default)

- help                         Provides help information about console commands.

    help/index (default)       Displays available commands or the detailed information

- job


    job/index (default)

- message                      Extracts messages to be translated from source files.

    message/config             Creates a configuration file for the "extract" command using command line options specified

    message/config-template    Creates a configuration file template for the "extract" command.

    message/extract (default)  Extracts messages to be translated from source code.

php yii hello returns

Error: Unknown command "hello".

php yii hello/index returns

Error: Unknown command "hello/index".

Any help is welcome!

– Matt

Also here is my config for the console


$params = array_merge(

    require(__DIR__ . '/../../common/config/params.php'),

    require(__DIR__ . '/../../common/config/params-local.php'),

    require(__DIR__ . '/params.php'),

    require(__DIR__ . '/params-local.php')


return [

    'id' => 'app-console',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log'],

    'controllerNamespace' => 'console\controllers',

    'components' => [

        'log' => [

            'targets' => [


                    'class' => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],





    'params' => $params,


It looks normal… since it’s Windows→Linux type of issue, I’d suspect case sensitivity i.e. do you have any files or directories named in one case and called in another case?

Thanks a lot the filename of my controller was 1 upper case short!