Thursday, 17 January 2019

php - laravel error cron uses



Laravel error





cron uses /usr/bin/php /home/sitevk/artisan schedule:run 1>>
/dev/null: 2>&1




App\Console\Kernel:



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: exception 'ErrorException' with
message 'Invalid argument supplied for foreach()' in
/home/sitevk/vendor/symfony/console/Input/ArgvInput.php:287 Stack
trace:
#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(Object(Symfony\Component\Console\Input\ArgvInput),
Object(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(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}



Answer



It was necessary to put a higher version of php


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...