简体   繁体   中英

Laravel schedule command with cron

I have command log:demo and I successfully run it from ssh console with command: php artisan log:demo .

Now I need to create cron job and its ok but when cron starts a command I get in laravel.log:

> [2016-03-22 21:45:01] local.ERROR: exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /home/agroagro/public_html/vendor/symfony/console/Input/ArgvInput.php:283
Stack trace:
#0 /home/agroagro/public_html/vendor/symfony/console/Input/ArgvInput.php(283): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/agroagro/...', 283, Array)
#1 /home/agroagro/public_html/vendor/symfony/console/Application.php(790): Symfony\Component\Console\Input\ArgvInput->hasParameterOption(Array)
#2 /home/agroagro/public_html/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->configureIO(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/agroagro/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/agroagro/public_html/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}  

Why does manually calling command work, but cron does not?

does the cron run with the same user and privileges as you do? is the bash the same? check php version...

that was the problems on my server...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM