0

I show you below some dummies examples about I want to do. I need to start a background process using symfony2. This function is in a Controller and I would like to return the response while the command line is running. If I do what I put below it's pretty similar when I call some normal function. I mean, the controller doesn't send back to the user the "ok" untill the process ends.

How can I run it in background?

public function checkAction(Request $request){        
    $process = new Process('php /home/isma/Documents/kangoosave_backend/app/console fusion:contact:allusers');
    $process->start();

    return "ok";    
}
luchaninov
  • 6,792
  • 6
  • 60
  • 75

2 Answers2

-1

Try this command line:

php /home/isma/Documents/kangoosave_backend/app/console fusion:contact:allusers & disown

eRIZ
  • 1,477
  • 16
  • 32
-1

Try this:

/.../

$process = new Process('php '. $kernel->getRootDir() .'/console fusion:contact:allusers');

/.../
scoolnico
  • 3,055
  • 14
  • 24