How to background a process via proc_open and have access to STDIN?

后端 未结 1 1197
甜味超标
甜味超标 2021-01-21 02:12

I\'m happily using proc_open to pipe data into another PHP process. something like this

$spec = array (
    0 => array(\'pipe\', \'r\'),
    // I         


        
1条回答
  •  爱一瞬间的悲伤
    2021-01-21 02:58

    You can't write to STDIN of a background process (at least, not in the normal way).

    This question on Server Fault may give you some idea of how to work around this problem.

    Unrelated: you say do don't need outputs in the spec, yet you specify them im your $cmd; you can write $spec like this:

    $spec = array (
        0 => array('pipe', 'r'),
        1 => array('file', 'out.log', 'w'), // or 'a' to append
        2 => array('file', 'err.log', 'w'),
    );
    

    0 讨论(0)
提交回复
热议问题