Fork process and return responder?


Newbie question (might be more related to php than slim…)
Say I have a long job that needs to be executed for a specific route, but I want to return immediately a respond saying “job started”.
How do I start the long job in php?

$app->get(’/submitJob’, function (Request $request, Response $response) {
$response->getBody()->write(“Job in progress…”);

// How do I start a new process here to do some serious work on the server, but return immediately the response to the client?
return $response;


Use a queue system like beanstalkd, RabbitMQ or Gearman.


Gotcha. Thanks for the tips!