|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-30 05:16 UTC] kripper3 at hotmail dot com
[2009-06-30 07:52 UTC] pajoye@php.net
[2009-07-03 16:19 UTC] kripper3 at hotmail dot com
[2009-07-03 16:22 UTC] pajoye@php.net
[2009-07-07 16:48 UTC] kripper3 at hotmail dot com
[2009-07-07 16:57 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
Description: ------------ proc_open() doesn't read from stdin, when running PHP from console. Reproduce code works on PHP 5.1.2. popen works, but seems not to be suited for running interactive shell commands from PHP. Console scripts trying to run interactive commands will fail. Reproduce code: --------------- $espec_descriptor = array( 0 => fopen('php://stdin', 'r'), 1 => fopen('php://stdout', 'w'), 2 => array("file", "C:\\error-output.txt", "a") ); $cmd = "<any command reading from stdin, for example: plink.exe>"; $process = proc_open($cmd, $espec_descriptor, $pipes); if (is_resource($process)) { set_time_limit(0); return proc_close($process); } else { return -1; } Expected result: ---------------- proc_open() should run the command and allow it to read from stdin. Actual result: -------------- Commands fail to read from stdin and close inmediatly.