Closed 6562680 closed 6 days ago
An example with "file" output: https://github.com/user-attachments/assets/fe0004f3-62a5-449c-bf3a-7142d07c7c0b
Try
$pipesSpec = [
0 => ['socket'],
1 => ['socket'],
2 => ['socket']
];
instead of
$pipesSpec = [
0 => ['pipe', 'r'],
1 => ['pipe', 'w'],
2 => ['pipe', 'w'],
];
That may work or not. See https://www.php.net/manual/en/migration80.new-features.php#migration80.new-features.standard for a bit more info (well, actually not much more).
ps. somewhere on php.net comments i found the comment where man told that "windows already (i mean - today) has possibility to work with non-blocking pipes, but old PHP core code still dont support it, so people used additional process with TCP/IP socket and proxy pipe through it... I didnt check that socket workaround, but "already has possibility" looks promising.
See #5777/#5864.
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.
Description
Actually i have not so much experience with resources or sockets, but tomorrow i tried to create videostream using PHP and
ffmpeg
tool.There's mode that allows to pass data with PIPE to input and receive data with PIPE from the output.
Guess, it works great on Unix systems, but still works problematic with Windows.
Short example:
The problem is in that line never reach first byte (infinite reading loop is happened) because reading pipe never closed (maybe ffmpeg buffers the output, but
flush_packets
argument should do the job, instead it wont work):But once i closed that pipe - i cannot organize unlimited
stream
- only one bulk of data can be passed (we cant reopen closed pipe known way)It seems a very old and known bug, but maybe after that years some solution was found by php devs team?
ps. somewhere on php.net comments i found the comment where man told that "windows already (i mean - today) has possibility to work with non-blocking pipes, but old PHP core code still dont support it, so people used additional process with TCP/IP socket and proxy pipe through it... I didnt check that socket workaround, but "already has possibility" looks promising.
ps2. of course, production will work on Unix systems... But actually would be great to write application on windows, test it, and then push it to production, instead of using few OS on home machine (of course, possible with VM or maybe Docker, but... please!)