What is the output of queue/run
?
What is the output of queue/run
?
in console? Nothing.
Also, command yii queue/listen -v --color ends up with output like 2019-01-10 13:01:19 [pid: 6000] - Worker is started, but that’s it.
upd: I tried it with -v parameter
Can you add some output to the job execute
method?
It seems execute
method isn’t run…
public function execute($queue)
{
Yii::debug('tesssst');
echo 'teeeest';
file_put_contents($this->file, $this->text);
}
I noticed that runtime\queue\index.data contains just a:0:{} while \web\runtime\index.data has the data of all jobs starting with a:2 (I wonder why not a:0…). So, I copied everything from latter index.data to the former, and all job.data as well. With having it done I got an error at least:
So, it looks like the problem is the jobs are being pushed in web but the run method looks for them in concole…
What PHP version you have?
It’s php 5.6
And I installed the extention via composer require… instead of php composer.phar… if it’s somehow matter…
Doesn’t matter if composer is used from phar or not.
It should work but based on error it looks like PHP version mismatch…
meh… php -v gives me version 5.6, same is in openserver’s php info
Try doing composer update
locally instead of composer install
. Looks like components installed do not match PHP version constraint.
Yeah, it works now)
I’ve been trying “composer -upd” or something like this a few days ago but it was “there’s nothing to update” that time.
Thanks.
It’s weird, I just had the exact same issue, working on porting a legacy app to yii2 on PHP 5.6.
The problem seems to be related to yii2-queue 2.1.0 which requires “*” for symfony/process, which ends up downloading v4.x which is incompatible with PHP5.
Downgrading to last yii-queue 2.0.x seems to fix the problem.
This issue is already addressed for 2.1.1 which is not out yet: https://github.com/yiisoft/yii2-queue/issues/267
Beware, the problem may still exist but it’s working case the job is marked as reserved
so symfony/process doesn’t kick in yet. Try adding a new job to the queue and run the command again.
If it still fails, set the version of yii2-queue to 2.0.2
in your composer.json & run composer update again.
The only issue left is it works with console command but doesn’t with Yii::$app->queue->run();
So jobs.data from runtime folder are executed, that from web\runtime don’t
2019-05-08 22:04:40 [-][-][-][error][ParseError] ParseError: syntax error, unexpected ‘?’, expecting variable (T_VARIABLE) in C:\xampp\htdocs\app\vendor\symfony\process\Process.php:140
Stack trace:
#0 C:\xampp\htdocs\yeni-portal\vendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile(‘C:\xampp\htdocs…’)
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass(‘Symfony\Compone…’)
#2 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\cli\Command.php(167): spl_autoload_call(‘Symfony\Compone…’)
#3 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\cli\Command.php(106): yii\queue\cli\Command->handleMessage(‘4046’, ‘O:34:"app\modul…’, ‘300’, 1)
#4 [internal function]: yii\queue\cli\Command->yii\queue\cli{closure}(‘4046’, ‘O:34:"app\modul…’, ‘300’, 1)
#5 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\cli\Queue.php(136): call_user_func(Object(Closure), ‘4046’, ‘O:34:"app\modul…’, ‘300’, 1)
#6 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\drivers\db\Queue.php(84): yii\queue\cli\Queue->handleMessage(‘4046’, ‘O:34:"app\modul…’, ‘300’, 1)
#7 [internal function]: yii\queue\db\Queue->yii\queue\db{closure}(Object(yii\queue\cli\SignalLoop))
#8 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\cli\Queue.php(108): call_user_func(Object(Closure), Object(yii\queue\cli\SignalLoop))
#9 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\drivers\db\Queue.php(94): yii\queue\cli\Queue->runWorker(Object(Closure))
#10 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2-queue\src\drivers\db\Command.php(56): yii\queue\db\Queue->run(false)
#11 [internal function]: yii\queue\db\Command->actionRun()
#12 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#13 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#14 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\console\Controller.php(148): yii\base\Controller->runAction(‘run’, Array)
#15 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\base\Module.php(528): yii\console\Controller->runAction(‘run’, Array)
#16 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction(‘queue/run’, Array)
#17 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction(‘queue/run’, Array)
#18 C:\xampp\htdocs\yeni-portal\vendor\yiisoft\yii2\base\Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#19 C:\xampp\htdocs\yeni-portal\yii(18): yii\base\Application->run()
#20 {main}
Please open a new forum thread if you need assistance.
(and you seem to be using a library not compatible with your version of PHP)
That error looks like using outdated PHP version.