Laravel错误
cron使用/ usr / bin / php / home / sitevk / artisan schedule:run 1 >> / dev / null:2>&1
应用程序\控制台\内核:
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\User;
use Log;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\Inspire::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
Log::info('1');
$schedule->call(function () {
$user = User::find(1);
$user->first_name = 'cron...';
$user->save();
})->everyMinute();
}
}
Logs:
[2015-08-31 19:14:02] local.ERROR:异常'ErrorException',在/home/sitevk/vendor/symfony/console/Input/ArgvInput.php中显示消息'为foreach()提供的无效参数': 287堆栈跟踪:#0 /home/sitevk/vendor/symfony/console/Input/ArgvInput.php(287):Illuminate \ Foundation \ Bootstrap \ HandleExceptions-> handleError(2,'Invalid argumen ...','/ home / sitevk / ve ...',287,Array)#1 /home/sitevk/vendor/symfony/console/Application.php(827):Symfony \ Component \ Console \ Input \ ArgvInput-> hasParameterOption(Array)#2 /home/sitevk/vendor/symfony/console/Application.php(123):Symfony \ Component \ Console \ Application-> configureIO(对象(Symfony \ Component \ Console \ Input \ ArgvInput),对象(Symfony \ Component \ Console \ Output \ ConsoleOutput))#3 /home/sitevk/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(100):symfony \ Component \ Console \ Application-> run(Object(Symfony \ Component \) Console \ Input \ ArgvInput),Object(Symfony \ Component \ Console \ Output \ ConsoleOutput))#4 / home / sitevk / artisan(35): Illuminate \ Foundation \ Console \ Kernel-> handle(对象(Symfony \ Component \ Console \ Input \ ArgvInput),对象(Symfony \ Component \ Console \ Output \ ConsoleOutput))#5
3 回答
我也有同样的问题 . 我试图在cPanel上运行cron .
我做的是,
代替,
不知道怎么样但对我有用 . 问题可能与php命令提示符有关 .
有必要放一个更高版本的PHP
错误:ArgvInput.php第280行
在php.ini中将register_argc_argv设置为off
我们需要将register_argc_argv设置为true .
如果您仍然遇到此问题,请尝试在命令中使用php-cli -q而不是php . 示例:
至