PHP on a windows machine; Start process in background

后端 未结 5 1363
无人及你
无人及你 2020-12-10 06:46

I\'m looking for the best, or any way really to start a process from php in the background so I can kill it later in the script.

Right now, I\'m using: shell_exec($C

5条回答
  •  余生分开走
    2020-12-10 07:14

    Tried to achieve the same on a Windows 2000 server with PHP 5.2.8.

    None of the solutions worked for me. PHP kept waiting for the response.

    Found the solution to be :

    $cmd = "E:\PHP_folder_path\php.exe E:\some_folder_path\backgroundProcess.php";
    pclose(popen("start /B ". $cmd, "a"));  // mode = "a" since I had some logs to edit
    

提交回复
热议问题