2017-03-14 20:30
浏览 96


I need to make a background script that is spawned by PHP command line script that echos to the SSH session. Essentially, I need to do this linux command:

script/path 2>&1 &

If I just run this command in linux, it works great. Output is still displayed to the screen, but I can still use the same session for other commands. However, when I do this in PHP, it doesn't work the same way.

I've tried:

`script/path 2>&1 &`;

exec("script/path 2>&1 &");

system("script/path 2>&1 &")

...And none of these work. I need it to spawn the process, and then kill itself so that I can free up the session, but I still want the output from the child process to print to the screen.

(please comment if this is unclear... I had a hard time putting this into words :P)

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题