Laravel 5.2 cron作业运行但出错

时间:2016-06-22 08:36:19

标签: php laravel cron

我在namecheap共享主机中使用laravel 5.2。我跟着laravel官方文档并最终出错。我尝试了很多suggeatios但没有任何作用。我使用php 7.0.7并将register_argc_argv设置为= On

我该如何解决这个问题?我的cron命令

php /home/wpbatgag/public_html/torpedo/artisan schedule:run 1>> /dev/null 2>&1

这是错误

[2016-06-22 08:30:17] local.ERROR: ErrorException: Invalid argument supplied for foreach() in /home/wpbatgag/public_html/torpedo/vendor/symfony/console/Input/ArgvInput.php:286
Stack trace:
#0 /home/wpbatgag/public_html/torpedo/vendor/symfony/console/Input/ArgvInput.php(286): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/wpbatgag/...', 286, Array)
#1 /home/wpbatgag/public_html/torpedo/vendor/symfony/console/Application.php(740): Symfony\Component\Console\Input\ArgvInput->hasParameterOption(Array, true)
#2 /home/wpbatgag/public_html/torpedo/vendor/symfony/console/Application.php(114): Symfony\Component\Console\Application->configureIO(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/wpbatgag/public_html/torpedo/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/wpbatgag/public_html/torpedo/artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}  

1 个答案:

答案 0 :(得分:1)

使用php-cli:

php-cli -q /path/to/artisan schedule:run >> /dev/null 2>&1

而不是php:

php /path/to/artisan schedule:run 1>> /dev/null 2>&1