How to solve the problem of unsuccessful scheduled tasks in yii2
How to solve the problem if the yii2 scheduled task is unsuccessful
I wrote a script using the Yii2 console and executed it on the command line All OK. It was put into cron and executed on time, but the execution effect was wrong, and the console script execution result was wrong.
After checking, it is due to the php path problem of the yii script (yii under the root directory)
You need to replace the first line of the following code, php, with the path on your server
#!/usr/bin/env php <?php /** * Yii console bootstrap file. * * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); require(__DIR__ . '/common/config/bootstrap.php'); require(__DIR__ . '/console/config/bootstrap.php'); $config = yii\helpers\ArrayHelper::merge( require(__DIR__ . '/common/config/main.php'), require(__DIR__ . '/common/config/main-local.php'), require(__DIR__ . '/console/config/main.php'), require(__DIR__ . '/console/config/main-local.php') ); $application = new yii\console\Application($config); $exitCode = $application->run(); exit($exitCode);
Or add a soft connection to the PHP executable file on the server
ln -s /usr/local/php/bin/php /usr/local/bin/php
ln - s The absolute path where the current file absolute path is to be placed
Recommended: "YII Tutorial"
The above is the detailed content of How to solve the problem of unsuccessful scheduled tasks in yii2. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to remove jquery from yii2: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and add the configuration "'yii" under the field "components" \web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

The scheduled task is scheduled to execute atat at a specified time point at a time, and the one-time task depends on the atd service. It needs to be started to realize the at task. The at queue is stored in the /var/spool/at directory -V: Display version information -l: List the specified queue Jobs waiting to be run; equivalent to atq-d: delete the specified job; equivalent to atrm-c: view specific job tasks [root@localhost~]#systemctlstartatd[root@localhost~]#systemctlenableatd[root@localhost~]# atnow+1minat>useraddxwzat>#

This article will introduce you to the yii2 framework, share a few CTF exercises, and use them to learn the yii2 framework. I hope it will be helpful to everyone.

Most users don’t know what the scheduled power on and off setting method for windows 7 is. Specifically, win7 can be set to automatically shut down, but users don’t know how to set it up. In fact, it can be set by entering a simple code, and you need to use cmd to set it up. The following is an introduction to the actual Windows 7 timer power on and off setting method. Users can refer to it and set it up, which is very simple. What is the method to set the timer on and off of Windows 7? 1. Set automatic shutdown. In fact, it can only be done from within the capabilities of the system itself, i.e. entering the shutdown command in the action box. Open the menu bar and click Action. If not, just press the shortcut key to open it, win+r to open it. 2. For example, if we want to turn off the power after three hours

With the rapid development of the Internet, more and more websites and applications need to perform some scheduled tasks and planned tasks in the background, such as data cleaning, backup, statistical analysis, etc. As a popular web development language, PHP also provides corresponding scheduled task and planned task technology. This article will introduce the scheduled task and planned task technology in PHP in detail. 1. Concept and usage scenarios of scheduled tasks 1.1 Concept Scheduled tasks refer to automatically executing some specified tasks or operations within a specified time point or time interval. 1.2 make

1. You need to download the windows version of the master branch of yii2-redis with composer 2. Unzip and copy it to vendor/yiisoft 3. Add 'yiisoft/yii2-redis'=>array('name'=>'yiisoft to extensions.php under yiisoft /yii2-redis','version'=>'2.0.

Timing tasks and planned task management of PHP and small programs With the continuous development of Internet technology, many websites and applications need to perform certain tasks regularly, such as data cleaning, data analysis, data synchronization, etc. In PHP and small program development, how to manage scheduled tasks and planned tasks is an important topic. This article will introduce how to use PHP and applets to manage timed tasks and planned tasks, and give corresponding code examples. Scheduled task management in PHP In PHP, we can use Cron to manage scheduled tasks.

How to implement scheduled tasks and scheduled tasks through the Webman framework? Webman is a lightweight web framework developed based on Go language. It provides a simple way to implement scheduled tasks and planned tasks. This article will introduce how to use the Webman framework to implement timed tasks and scheduled tasks, and provide corresponding code examples. Before using the Webman framework, you need to install Webman first. Webman can be installed with the following command: gogetgithub.com/he
