Skip to content
Advertisement

How to run Symfony Process function inside queue jobs on laravel

Now i’m doing some project use laravel framework. do i able to run Symfony Process function inside a queue jobs?

use SymfonyComponentProcessProcess;
use SymfonyComponentProcessExceptionProcessFailedException;

right now i want to run some commend using Symfony Process function for this

process = new Process("facebook-scraper --filename public/data/nintendo.csv --pages 5 nintendo");

if outside the queue. this code can run succesful. but when i want to make it run inside the queue jobs. it can’t.

how do i able to run symfony Process function inside queue on jobs laravel.

Advertisement

Answer

I think the problem is the paths. Replace the --filename option value with the absolute path (from /):

$path = public_path('data/nintendo.csv');

$process = new Process("facebook-scraper --filename {$path} --pages 5 nintendo");

...

And try to use full path to executable (facebook-scraper). You can use which to find it.

Example:

$ which facebook-scraper       
/usr/bin/facebook-scraper
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement