Hi,
i want use a cronjob with yii2. I have added a folder named console/controllers in my yii-folder. In this folder i have the follow controller named CronjobController.php:
<?php
namespace console\controllers;
use yii\console\Controller;
/**
* cronjob controller
*/
class CronjobController extends Controller {
public function actionIndex() {
echo "cron service runnning";
}
public function actionMail($to) {
echo "Sending mail to " . $to;
}
}
?>
Now i want to call the script with php yii cronjob. But i became an error message:
Unknown command: cronjob
Caused by: Exception ‘yii\base\InvalidRouteException’ with message ‘Unable to resolve the request “cronjob”.’
in C:\xampp\htdocs\netscan\vendor\yiisoft\yii2\base\Module.php:561
i do it all how:
https://www.yiiframework.com/wiki/646/how-to-implement-cron-in-yii-2
What is the problem there? I use yii2 basic.