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
<?php
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/greet
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