start /B doesn't start the task

Posted by Fractaliste on Stack Overflow See other posts from Stack Overflow or by Fractaliste
Published on 2014-06-06T15:57:49Z Indexed on 2014/06/10 15:24 UTC
Read the original article Hit count: 171

I'm currently launching an asynchronous job with PHP to perform some tests.

To make it work, I found on SO some tips, like the use of popen and start:

$commande = "testu.bat";
$pid = popen('start /B ' . $commande, 'r');
$status = pclose($pid);

The testu.bat's folder is in my user PATH.

This script performs some task, and to control it's execution, it should generates a log file, but I never get it.

Whereas if I just remove the /B option, it works fine and I get my log file.

Did I miss something about background execution? How can I catch the error informations when it is running in the background?

© Stack Overflow or respective owner

Related posts about php

Related posts about Windows