Giter VIP home page Giter VIP logo

Comments (23)

barryvdh avatar barryvdh commented on July 21, 2024

Or you on the latest dev version? Can you debug if the command is given correctly? No error logs?

from laravel-async-queue.

GrahamCampbell avatar GrahamCampbell commented on July 21, 2024

What version are you using?

from laravel-async-queue.

aalyusuf avatar aalyusuf commented on July 21, 2024

Tried 0.2.1 and latest dev, both are the same.
No error logs, just inserted. How can i debug if command is give correctly?

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

https://github.com/barryvdh/laravel-async-queue/blob/master/src/AsyncQueue.php#L68

Output the result from getCommand() (or log it or something)

public function startProcess($jobId)
{
    chdir($this->container['path.base']);
    die($this->getCommand($jobId));
}

from laravel-async-queue.

aalyusuf avatar aalyusuf commented on July 21, 2024

'/usr/bin/php' artisan queue:async 6 --env=production > /dev/null 2>&1 &

This isn't the php path. ( On OSX )

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

Okay what is the correct path? What PHP version are you on?

Does the PHP_BINARY give you the correct value? You are on the latest dev-master, right?

Using:

protected function getPhpBinary()
{
    $path = escapeshellarg($this->phpfinder->find(false));
    $args = implode(' ', $this->phpfinder->findArguments());
    return trim($path.' '.$args);
}

Can you try a different way, by requiring sebastian/environment (https://github.com/sebastianbergmann/environment) and doing this:

use SebastianBergmann\Environment\Runtime;
$runtime = new Runtime;
var_dump($runtime->getBinary());

If that gets more reliable results, I can use that to detect the path.

from laravel-async-queue.

GrahamCampbell avatar GrahamCampbell commented on July 21, 2024

sebastian/environment didn't work at all for me, which is why I removed it again. On windows, it was returning the path to the apache executable!

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

Pff, why is it so hard to just find the php binary path. Maybe just make a config about it and put php as the default.

from laravel-async-queue.

GrahamCampbell avatar GrahamCampbell commented on July 21, 2024

That's not a bad idea tbh. I do that in one of my packages to find "git". Maybe we should have an option to enable autofinding too?

from laravel-async-queue.

aalyusuf avatar aalyusuf commented on July 21, 2024

sebastian/environment returned an empty string, PHP_BINARY seems defined but empty, not sure what's the reason.

from laravel-async-queue.

tremby avatar tremby commented on July 21, 2024

Same issue here. I don't have time to debug this one so I'm moving on, but I hope this gets resolved.

from laravel-async-queue.

 avatar commented on July 21, 2024

Why this jobs aren't automatically started? I need add to queue job, next method continue and job working in background

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

Are you two having the same issue, about the path not being found? See the above commit, does that fix it for you? It defaults to 'php', but if you add a 'binary' option to the queue config, it should change.

'async' => array(
    'driver' => 'async',
    'binary' => '/path/to/php',
),

from laravel-async-queue.

 avatar commented on July 21, 2024

Thank you for replay, in now works very well

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

I've tweakd it a bit more. Should work the same as before, but auto-detection is removed (as it didn't really work), binary is escaped and arguments can be added also if you need.
Should not change anything for most ;)

Can the others confirm this fixes it?

from laravel-async-queue.

 avatar commented on July 21, 2024

I have to resing for this soolution, beacouse I have only hosting and i can't use php commend in script. I'am waiting for new server. Thank you

from laravel-async-queue.

aalyusuf avatar aalyusuf commented on July 21, 2024

Mark as solved - i guess

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

You guess? Or did you test it? :P

from laravel-async-queue.

aalyusuf avatar aalyusuf commented on July 21, 2024

Tested, path&command is correct but it's not getting executed.
Command works when executed through terminal but not being executed. Still testing what's wrong.

Edit: non-issue, works perfectly

from laravel-async-queue.

slipy90 avatar slipy90 commented on July 21, 2024

Hi!

I think I found the solution for windows users.
There was two problems around exec():

  1. Wrong start parametering. The first param with double quotes is the title of the window and after that comes the program and so on. Because you use escapeshellarg() the command was the following:
    start /B "php" artisan queue:async 72 --env=local > NUL, so php is the name of the new window and artisan was the program to start. Put two double quotes after the /B param in getBackgroundCommand() and the command will be:
    start /B "" "php" artisan queue:async 72 --env=local > NUL
  2. I don't know why but the exec() method always run synchronously. For this I found the solution here: http://php.net/manual/en/function.exec.php#86329

After these fixies it works like a charm for me.

Thanks for this plug-in :)

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

@slipy90 On what branch are you? The master branch doesn't escape the php command on windows and uses the Symfony Process instead of exec.

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 21, 2024

I've tagged v0.3.1, can you try with that?

from laravel-async-queue.

slipy90 avatar slipy90 commented on July 21, 2024

I used v0.3.0 and updated to v0.3.1 and works like a charm! Thanks for it!

from laravel-async-queue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.