【发布时间】:2015-06-18 02:29:07
【问题描述】:
试图让队列在我的共享主机上工作,
- 我设置了一个 cron 作业,每分钟运行一次 'php artisan queue:work'。
- 我正在使用数据库驱动程序
- 作业正常进入作业表
- 如果我使用同步驱动程序,它可以在我的共享主机上运行 在我的开发者机器上,它同时适用于同步和数据库驱动程序。
- 我不喜欢 Laravel Queue: How to use on shared hosting 提供了足够的答案,因为我有 cron 的可能性,因此我想让它与数据库驱动程序一起使用
- php 是 5.5 版,来自 cli 和 web 界面。
php artisan queue:work on my shared host (via cron) 返回
[ErrorException]
Invalid argument supplied for foreach()
在我的日志文件中写了以下内容。
[2015-04-12 18:59:01] production.ERROR: exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /home/a109/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:287 Stack trace:
#0 /home/a109/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php(287): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Invalid argumen...', '/home/a109/vend...', 287, Array)
#1 /home/a109/vendor/symfony/console/Symfony/Component/Console/Application.php(823): Symfony\Component\Console\Input\ArgvInput->hasParameterOption(Array)
#2 /home/a109/vendor/symfony/console/Symfony/Component/Console/Application.php(123): Symfony\Component\Console\Application->configureIO(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/a109/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/a109/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}
在 vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php 的第 287 行有这个函数
/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
*
* @return bool true if the value is contained in the raw parameters
*/
public function hasParameterOption($values)
{
$values = (array) $values;
foreach ($this->tokens as $token) {
foreach ($values as $value) {
if ($token === $value || 0 === strpos($token, $value.'=')) {
return true;
}
}
}
return false;
}
这就是失败的傻瓜。
我怎样才能让它工作?
【问题讨论】: