|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-07 15:16 UTC] nlopess@php.net
[2006-06-07 17:08 UTC] n dot escuder at intra-links dot com
[2006-06-25 17:51 UTC] jdolecek at NetBSD dot org
[2006-06-26 07:55 UTC] n dot escuder at intra-links dot com
[2006-09-08 20:57 UTC] tony2001@php.net
[2006-09-09 13:30 UTC] n dot escuder at intra-links dot com
[2006-09-09 13:43 UTC] tony2001@php.net
[2011-05-02 14:51 UTC] bogdan at moongate dot ro
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 14:00:01 2025 UTC |
Description: ------------ When executing a program with proc_open the child process that is started by proc_open have all fd's that was opened in the master script ex: file, database connection .... The child process must don't have any fd open expect the fd specified by $descriptorspec. Reproduce code: --------------- <? $fd = fopen("/tmp/test.log", "w"); $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $pipes = null; $process = proc_open("ls /proc/self/fd -l", $descriptorspec, $pipes); while ( ( $line = fgets($pipes[1]) ) ) { echo $line; } proc_close( $process ); fclose($fd ); ?> Expected result: ---------------- total 5 lr-x------ 1 root root 64 2006-06-07 12:44 0 -> pipe:[22573] l-wx------ 1 root root 64 2006-06-07 12:44 1 -> pipe:[22574] l-wx------ 1 root root 64 2006-06-07 12:44 2 -> pipe:[22575] lr-x------ 1 root root 64 2006-06-07 12:44 3 -> /proc/19964/fd Actual result: -------------- total 5 lr-x------ 1 root root 64 2006-06-07 12:44 0 -> pipe:[22573] l-wx------ 1 root root 64 2006-06-07 12:44 1 -> pipe:[22574] l-wx------ 1 root root 64 2006-06-07 12:44 2 -> pipe:[22575] l-wx------ 1 root root 64 2006-06-07 12:44 3 -> /tmp/test.log lr-x------ 1 root root 64 2006-06-07 12:44 4 -> /proc/19964/fd