How to create a console command in Yii 2 advanced?

The situation is this: I have 2 machines, each identical environments and source files of the project. On one it works, the other is not. And I can't understand why...

File var/www/site/console/config/main.php
return [
...
 'controllerNamespace' => 'console\controllers',


File test console controller var/www/site/console/controllers/TestController.php
<?
namespace console\controllers;

use Yii;

class TestController extends \yii\console\Controller
{
 public function actionIndex()
{
 print 1;
}
}


In the console recruit
php yii-test/index

Get the error
<?
namespace console\controllers;

use Yii;

class TestController extends \yii\console\Controller
{
 public function actionIndex()
{
 print 1;
}
}Exception 'yii\base\UnknownClassException' with message 'Unable to find 'console\controllers\TestController' in file: /var/www/site/console/controllers/TestController.php. Namespace missing?'

in /var/www/site/vendor/yiisoft/yii2/BaseYii.php:291

Stack trace:
#0 [internal function]: yii\BaseYii::autoload('console\\control...')
#1 [internal function]: spl_autoload_call('console\\control...')
#2 /var/www/site/vendor/yiisoft/yii2/base/Module.php(633): class_exists('console\\control...')
#3 /var/www/site/vendor/yiisoft/yii2/base/Module.php(591): yii\base\Module->createControllerByID('test')
#4 /var/www/site/vendor/yiisoft/yii2/base/Module.php(517): yii\base\Module->createController('index')
#5 /var/www/site/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('test/index', Array)
#6 /var/www/site/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('test/index', Array)
#7 /var/www/site/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->handleRequest(Object(yii\console\Request))
#8 /var/www/site/yii(27): yii\base\Application->run()


How to be, prompt?
March 23rd 20 at 18:47
1 answer
March 23rd 20 at 18:49
Solution
Php short tags - it is you brought the contents of the file

Find more questions by tags Yii