Laravel计划命令与cron

时间:2016-03-22 21:49:30

标签: php laravel cron command

我有命令log:demo并且我使用命令php artisan log:demo从ssh控制台成功运行它。

现在我需要创建cron作业,但是当cron启动命令时我会进入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}  

为什么手动调用命令工作,但cron不工作?

1 个答案:

答案 0 :(得分:2)

cron是否以与您相同的用户和权限运行? bash是一样的吗?检查php版本......

那是我服务器上的问题...